java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

1

You hit this brick wall within minutes of trying to use report studio for the first time.

I cannot find any documenation which says how to get this jar, or how to include it on the class path which various forums say is the answer to this error.

The only place I can find the driver is here:  http://dev.mysql.com/downloads/connector/j/

But sadly, this only allows you to download an MSI installer, not the jar.

Please could someone tell me where to get the jar, and how to edit jasper studios class path to include it.

I have mysql installed and a 1.7 java JDK, but neither install dirs seem to contain the missing mysql jar.

Windows 8 64 bit, My SQL 5.6, studio 5.6.0.final.

Why is this not included?  It would save untold pain for users who just want to write reports against mysql - not learn how to administer java.

john.v.little's picture
Joined: Aug 28 2014 - 3:29am
Last seen: 4 years 11 months ago

In the end, I downloaded the MSI installer from oracle, then used 7-zip to extract the Jar. I tried installing the msi, but couldnot find where it puts the jar, so gave up with that one and uninstalled it.

john.v.little - 4 years 11 months ago

3 Answers:

0

Is not included for license contraints on the MySQL side. If you install that MSI it will create a folder with the JAR's you need.

Also the MariaDB driver which is included is compatible with MySQL (https://mariadb.com/kb/en/mariadb/client-libraries/mariadb-java-client/a...) so you can use that one

marianol's picture
4555
Joined: Sep 13 2011 - 8:04am
Last seen: 10 months 3 weeks ago
0
djohnson53's picture
65323
Joined: May 25 2012 - 11:10am
Last seen: 11 hours 26 min ago
7

The post author has a valid point, it's amazing that step-by-step instructions for new users dissolve into obscurity in cases like this.  Granted there are multiple environments to take into account, but clear instructions for the 5 or so most common installations would be helpful.  If a user needs to Google assistance, the instructions are inherently lacking.

For those working on a Windows installation and a MySQL database, here's what worked (and didn't work) for me:

  1. You will need a JDBC driver .jar file.  Go to http://dev.mysql.com/downloads/connector/j/ , and download the file identified by 'Platform Independent (Architecture Independent), ZIP Archive'.
  2. Open the mysql-connector-java-x.x.x.zip file;  open the folder 'mysql-connector-java-x.x.x'.  This should reveal a set of files that include 'mysql-connector-java-x.x.x-bin.jar'.
  3. Copy this jar file to your server;  I created a dedicated folder, C:/jdbc for this purpose.
  4. Discover the issue shown at http://community.jaspersoft.com/wiki/tibco-jaspersoft-studio-jdbc-connec... .  Ignore all the fuss you may read about modifying CLASSPATH.
  5. In Jaspersoft Studio, click the 3rd icon in the icon bar after 'Build All' (this is the 'New Data Adapter' icon; there is no menu equivalent for this).  Set your adapter folder/filename, then click Next.
  6. Select 'Database JDBC Connection';  click Next.
  7. Set the following in the 'Database Location' tab:
    1. JDBC Driver:    MySQL (com.mysql.jdbc.Driver)
    2. JDBC URL:       jdbc:mysql://localhost:3306/your-database-name    (3306 is a default MySQL port, yours might be different)
    3. Username:        (admin-access account name for database)
    4. Password:         (admin-access account password for database)
  8. As noted in the above link, select the 'Driver Classpath' tab;  click Add.
  9. Find your saved jar file and add it here.
  10. Click Test to test the connection;  hopefully everything worked and your connection succeeded.  Click Finish to save.

 

lisay_1's picture
73
Joined: Aug 4 2016 - 5:24am
Last seen: 2 years 5 months ago
Feedback
randomness