Help needed: Creating a MySQL database and using Java to manipulate it

#1

Hello, i'm having problems while creating a MySQL database in Manjaro.
For context: I'm a computer engineering student, and i need to create a Java application to control a MySQL database.

I did found some tutorials regarding MariaDB, and i was able to install it, and confirm that the database is online. The only problem is when i step on the java side of connection. I did downloaded the jdbc mariadb driver, and currently i'm using a test code i found on arch linux wiki specifically for this case. I included the driver in the classpath, but during code execution it fails compiling and throws me a java.sql.SQLException: No suitable driver found for jdbc:mariadb://127.0.0.1:3306/test.

I hope not to be making some gross mistake, and please be patient with me.

#2

Firstly, https://wiki.manjaro.org/index.php?title=Forum_Rules#Homework

Secondly, you're paying to be on a course so you should use the locally-available resources. That means teachers, lecturers, demonstrators, technical support, other students, etc. etc. etc.

Thirdly,

you'll have to be much more specific if you want help with a programming issue.

Alternatively, you may simply need the mariadb-clients package.

1 Like
#3

Good night.

Actually, it's not a homework -> Just learning new stuff because i feel like i'll have to use it later, and i did tried to go for local help -> No Linux users around.

I'll try to detail it a bit more:
The objective: To create a DB and manage it with a Java application.
Creating the DB: Was able to create it using MariaDB and following a Arch Linux wiki tutorial -> Confirmed that it is indeed online using MySQL Workbench.
Integration with Java: Following the wiki, i assumed that i would need a JDBC MariaDB driver, so i got it, included it in project's classpath, however, the code fails to compile throwing a java.sql.SQLException: No suitable driver found for jdbc:mariadb://127.0.0.1:3306/test (Also, i do have mariadb-clients package).

The code i'm using right now to test the database is in https://www.codebunk.com/b/106331670/:

I'm really sorry for the lack of details, but this is the most i can specify of the issue.

#4

That doesn't seem to load, and is titled "New Interview", so...

1 Like
#5

Actually, i found out the issue, my driver file was actualy wrong, got it to work. Thanks so much, and sorry for the incovenience.

Have a good night mate!

1 Like
#6

It's good to share the knowledge. :wink:
What was wrong with the file and what was the right one?

1 Like
#7

Instead of downloading MariaDB/J connector, i accidentally downloaded MariaDB-client-sources, so the Java class was not recognizing it, because it wasn't the correct driver.

Lesson of the day: Read very well what you are downloading.

On the good side, i made some good progress, and i was able to manage my database with Java, was actually quite easy (despite this little error).

Thanks so much for the help guys, i wish this topic to be usefull, and take care :smiley:

2 Likes