This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes MySQL driver not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL driver not found" Watch "MySQL driver not found" New topic

MySQL driver not found

RajivAwadhesh kumar

Joined: May 20, 2011
Posts: 24

I am getting the following error when i execute the above code

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at com.rajiv.TestDB.readDataFromDB(
at com.rajiv.TestDB.main(

Please suggest why the above error is coming? where do i need to put the driver file for MySQL?
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Well, as always when you get that error, the class in question can't be found in your classpath. So where should you put the driver's JAR file? In your classpath.
hemantha kumar k

Joined: Apr 20, 2010
Posts: 27

add the mysql Connector jar in your class path it is going to solve your problem, if you are using the command prompt create the environment variable called "CLASSPATH" and set the value as the path of the mysql connector folder.
I agree. Here's the link:
subject: MySQL driver not found
Similar Threads
another JDBC driver question
Java-Xml file not getting Connected to DataBase
It gives Class not found exception for mySQL
mysql connection problem
not able to connect to the database