Jump to content
We've recently updated our Privacy Statement, available here ×

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


john.v.little
Go to solution Solved by lisay_1,

Recommended Posts

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.

Link to comment
Share on other sites

  • 1 year later...
  • Solution

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-connection-mysql-failed .  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.

 

  • Like 1
Link to comment
Share on other sites

  • 4 years later...

Lisay_1's answer worked for me - thank you VERY much!!

I ran into a subsequent timezone error that's apparently related to versions of the driver, giving the following error:

The server time zone value 'PDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specific time zone value if you want to utilize time zone support.[/code]

Simply follow the solution here:

https://stackoverflow.com/questions/26515700/mysql-jdbc-driver-5-1-33-time-zone-issue[/code]

Hope this helps someone else.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...