Skip to content
Advertisement

Use JDBC/Mysql Connector in intellij idea

I’m new in Java, and I need to establish a connection to a MySQL server (local), I have add the libraries in Intellij idea but it seems not work, the IDE can’t find the class i think… I become crazy I’m searching since two hours… I come from visual studio/c# dev environment and i think that i should miss something…

Here you can have a pic from my IDE and the simple code that I wanted use. You can also deduce that I have import the jar in my project (mysql-jdbc).

IDE pic

Edit : here is the code, the comment show where the error appear :

JavaScript

Advertisement

Answer

You have to add ‘mysql:mysql-connector-java:5.1.40’ from maven or add it as java library as shown:

enter image description here

Advertisement