ClassNotFoundException in class.forName()

Hi,

Iam using eclipse and iam trying to load the driver with class.forName().Iam using MySql and i included the mysql-connector-java-5.0.5-bin.jar

where the Driver class is.But iam getting the exception as

Exception caughtjava.lang.ClassNotFoundException: com.mysql.jdbc.Driver

and my code is :

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:odbc:venkat");

PreparedStatement pst=con.prepareStatement("insert into login values(?,?) ");

pst.setString(1,name);

pst.setString(2,id);

int n=pst.executeUpdate();

System.out.println(n+ "rows inserted");

Could anybody help me in clear this error.Thanks in advance

Regards,

Venkatesh.R

[761 byte] By [tanjore.tigera] at [2007-11-27 2:26:38]
# 1
Then you haven't included the jarfile correctly, try again.And on a side note, why do you load the mysql driver and then attempt to use the jdbc-odbc bridge?
masijade.a at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 2
I see nothing wrong.1) Are you sure you included the right jar ?2) Is the classpath set right?I made the mistake once to include the jar on my tomcat server but not in the project in my IDE, maybe here too ?
radicjesa at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 3
I have included the jar.Now once again i tried by removing and including the jar.Same problem is coming.Then i changed my code for mysql driver asConnection con=DriverManager.getConnection("jdbc:mysql:venkat");
tanjore.tigera at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 4
what does "including" a jar entail?
georgemca at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 5
That url is still wrong. It should be something like:jdbc:mysql://hostname:port/dbnameAlthough the ":port" part is only needed when MySQL is not running on the default port of 3306.How did you include the Driver? Describe your process.
masijade.a at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 6
In eclipse i have included mysql-connector-java-5.0.5-bin.jar in the class path
tanjore.tigera at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 7
Like I said, describe your process, click for click.
masijade.a at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 8
> In eclipse i have included> mysql-connector-java-5.0.5-bin.jar in the class pathyou can't have done, or this would work
georgemca at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 9
> Like I said, describe your process, click for click.Hi Mr.masijade,Iam creating connection object with jdbc:DriverName:DataSourceNamebut class.forName() is creating the problem.I dont know how to overcome this
tanjore.tigera at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...
# 10

> > Like I said, describe your process, click for

> click.

>

> Hi Mr.masijade,

>

> Iam creating connection object with

> jdbc:DriverName:DataSourceName

>

> but class.forName() is creating the problem.I dont

> know how to overcome this

what he - and I - mean is, exactly what steps do you take to add the jar to your classpath? exactly, mind you, not just "oh, I add it to the thing and press ok"

georgemca at 2007-7-12 2:36:12 > top of Java-index,Java Essentials,Java Programming...