Right click on Project in “Package Explorer” and Build path -> Configure Build Path. Now it’s time to add JDBC library in our project. Check whether this JAR is present in the application classpath. For example, in the case of, the JAR file that contains it is mysql-connector-java.jar. Inside “ src” folder in Project on “ Package Explorer” create new Java file and name it properly. The following steps should be followed to resolve a ClassNotFoundException in Java: Find out which JAR file contains the problematic Java class. The database driver class loads the mysql database driver from the driver’s jar. If the driver class is unable to load, the exception Cannot load driver class: will be thrown.
Open Eclipse, Create new Java project from File Menu. The java application attempts to load a driver class from the mysql database driver jar. Now its time to create Connection variable in order to connect to our database. With runtime, as I want to connect to MySQL server at runtime have also tried compile and provided, but does not work. Class.forName() This line will load the JDBC. I have a Java app based on Maven, and want to connect to MySQL server. To load the JDBC driver we are going to use Class.forName.
#Load the mysql jdbc driver java 64 Bit#
If you running Windows 64 bit like me then choose 64 bit Java and 64-bit Eclipse else you may face any issue (issue is debugged already. Import these classes which are Java built-in classes for SQL operation. NOTE: For this tutorial and running code successfully I am going to ask you to download the latest Java from here and the Eclipse editor. If you need to download the driver in a language other than the one detected for you, you can use these direct links. To know it go to I am going to use “ cdcol” database (it is example database comes with installation) to demonstrate my code. Download Microsoft JDBC Driver 6.0 for SQL Server (self-extracting exe) Download Microsoft JDBC Driver 6.0 for SQL Server (tar.gz) Version number: Released: January 17, 2017. Since this tutorial is about connecting to a MySQL database, I am not going to create a new database or that stuff, instead, I am going to use databases that come as an example in the MySQL database.