dbTalk Databases Forums  

ClassNotFoundError -- driver of jdbc

mailing.database.mysql-java mailing.database.mysql-java


Discuss ClassNotFoundError -- driver of jdbc in the mailing.database.mysql-java forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
d3957695@est.fib.upc.edu
 
Posts: n/a

Default ClassNotFoundError -- driver of jdbc - 02-24-2005 , 05:11 PM






Hi;

I'm using Connector/J, but I'm unable to solve o problem. I hae the following
Java code (taken from these web pages):

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class BD {

public static void main(String args[]) throws Exception {

Connection con = null;
try{

Class.forName("com.mysql.jdbc.Driver").newInstance ();
con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/test?user=root&password=pujols");

}

catch(SQLException ex){

System.out.println("SQLException: "+ex.getMessage());
System.out.println("SQLState: "+ex.getSQLState());
System.out.println("VendorError: "+ex.getErrorCode());

}
}
}


However, when I try to execute this file, I get a message error saying that it's
impossible to find the com.mysql.jdbc.Driver (ClassNotFoundException). I have
modified the Path of my system to include the jar file I found in the
Connector/J Zip (I think I did it correctly...). In case to delete this
sentence, I get a SQLException: not suitable driver.

What Am I doing bad? Where is the class I need? I haven't been able to find any
solution anywhere.

Thanks for all.

Sergi

--
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe: http://lists.mysql.com/java?unsub=my...ie.nctu.edu.tw


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.