Skip to content Skip to sidebar Skip to footer

Com.mysql.jdbc.driver Class Not Found Exception

I took help from this blog post: But I get com.mysql.jdbc.driver class not found exception. What's different in that blog post was that they've tried to connect to mysql instead of

Solution 1:

Download the JTDS driver from here and include it in your classpath. Build and run your code. It'll work.

Solution 2:

download the jar from: http://www.java2s.com/Code/Jar/s/Downloadsqljdbc430jar.htm then change these lines as below:

privatestaticfinalString url = "jdbc:sqlserver://Server.com:1433/DB_name";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

Solution 3:

You're missing the Mysql Connection JAR on your classpath.

This jar contains the driver: com.mysql.jdbc.Driver

However as you are using MSSQL and not MySQL I suggest you find a suitable driver for MSSQL instead.

Solution 4:

I guess there is a problem with the url stated.

try running on the local host first and then give the correct url that you have. "jdbc:mysql://localhost:3306/databaseName"

Solution 5:

You are loading the class for MYSQL DB connection, you should load the class for MS SQL and should include the required jar files in the build path. Edit the Class.forName line as below:

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();

Post a Comment for "Com.mysql.jdbc.driver Class Not Found Exception"