I have downloaded MySQL driver connector for java and I add it to librairies of my project but an error occur while connecting to my database " No suitable driver found for jdbc:mysql".
Asked
Active
Viewed 51 times
-1
-
1There's not enough information here to answer your question. Post the code on how you're initializing the driver and the connection so we can help you out. – lscoughlin Mar 01 '20 at 11:45
-
have you included the jdbc driver jar in your project. here is a [link](https://www.mysql.com/products/connector/) to the download – fuggerjaki61 Mar 01 '20 at 11:47
1 Answers
-1
In case the driver is not loaded, you can call the following statement before getting connection.
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
Check the link https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-usagenotes-connect-drivermanager.html

Gaurav
- 1,570
- 4
- 20
- 25
-
-
-
If the class isn't on the classpath, this throws the same exception, and this line hasn't been needed for a long time https://stackoverflow.com/a/24657416/2308683 – OneCricketeer Mar 01 '20 at 16:36
-
-