File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" Watch "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" New topic
Author

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

Bill Riedl
Greenhorn

Joined: Sep 08, 2009
Posts: 4
Hi,
I'm using NetBeans 6.7.1 and am trying to connect to a MySQL DB. Below is a snippet from my code(I cut out the actual connection parameters and placed their names in italics). I'm new to this and this is just a scratch method for me to play around. When I compile I receive an error stating that class "com.mysql.jdbc.Driver" cannot be found. a MySQL driver is packaged with NetBeans and this is the URL according to the documentation. Am I missing something?

Thanks for your help!

private void scratch() throws SQLException, ClassNotFoundException
{

Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection
("jdbc:mysql://address:port/database","username","password");

}
satishbsk kumar
Greenhorn

Joined: Jul 24, 2009
Posts: 15
place mysql-connector-java-*.bin.jar file in your class path
Bill Riedl
Greenhorn

Joined: Sep 08, 2009
Posts: 4
Thanks Satishbsk ...works now
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver