Sunday, 16 August 2015

The Driver Class 'com.mysql.jdbc.Driver' Could Not Be Loaded

The Driver Class 'com.mysql.jdbc.Driver' Could Not Be Loaded --If you are trying to connect LibreOffice Base to MySQL database, you may be encounter this error because of your LibreOffice Base not configured yet.

This article will show to you how to install, configure, and develop database applications using MySQL Connector/J, the JDBC driver for communicating with MySQL servers using LibreOffice Base.

The Driver Class 'com.mysql.jdbc.Driver' Could Not Be Loaded

This common error usually happen when you didn't install driver for JDBC Connector. You need to download and "register" the JDBC connector first inside your LibreOffice Base. JDBC Connector is a driver that implements the Java Database Connectivity (JDBC) API, which provides connectivity for client applications developed in the Java programming language with MySQL Connector/J.

To Produce this error you need to open LibreOffice Base and connect to MySQL database, then you want to test class from LibreOffice Base then it will fail and the error message appeared.

How to Solve The Driver Class 'com.mysql.jdbc.Driver' Could Not Be Loaded

First, you need to install JDBC Connector on your system. To do so please follow these steps :

Step 1
Go to select your platform and download the ZIP archive with the JDBC connector ("Platform-Independent"); you may alternatively download the MSI installer for Windows; in this case, the jar file can be found in Program Files/MySQL/MySQL Connector J/

Step 2
Unzip the archive on your local PC (remember the path to its contents), or alternatively install the MSI file;

Step 3
In the extracted folder structure, there's a file "mysql-connector-java-5.0.8-bin.jar" (name depends on the exact version you've downloaded)

Step 4
Run LibreOffice, (not Base just LibreOffice because if you run LibreOffice Base you will not see the menu)

Step 5
Click Menu Tools >> Options >> LibreOffice >> Advanced >> Please make sure "Use a java runtime environment" is ticked >> Class Path... >> Click Add Archive >> Then select the jar file from step 1-3 and hit OK or Open. Now, the Class Pathdialog should look as follows:

The Driver Class 'com.mysql.jdbc.Driver' Could Not Be Loaded

And your problem will gone when you trying to connect LibreOffice Base to MySQL database.
Disqus Comments