(Problem Solved) java.sql.SQLException No suitable driver found for jdbcmysql Netbeans
The error message “No suitable driver found for jdbc:mysql” typically indicates that the MySQL JDBC driver is not in the classpath of your application.
To fix this error, you will need to add the MySQL JDBC driver to your classpath.
Here is one way you can do this in NetBeans:
- Download the MySQL JDBC driver from the MySQL website (https://dev.mysql.com/downloads/connector/j/)
- Extract the ZIP file and copy the JAR file (e.g.,
mysql-connector-java-8.0.xx.jar) to a location on your computer
- In NetBeans, right-click on your project and select “Properties”
- In the “Project Properties” window, go to the “Libraries” category and click the “Add JAR/Folder” button
- Navigate to the location where you copied the JAR file and select it
- Click “OK” to close the “Project Properties” window
This should add the MySQL JDBC driver to your project’s classpath and allow you to connect to a MySQL database using the
Note: Make sure that you are using the correct version of the MySQL JDBC driver for your MySQL server. For example, if you are using MySQL 8.0, you will need to use the
run: Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:247) at MySqlToJtable.main(MySqlToJtable.java:28) C:\Users\HP\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)