MySQL Forums
Forum List  »  Microsoft SQL Server

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Posted by: Thamodara Jegan
Date: September 02, 2005 03:08AM

I have the following error when i try to run Java file which has connections for MYSQL.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
My program coding is

import java.sql.*;
public class newdata
{
static Connection cn;
static Statement smt;
static ResultSet rs;
public static void main(String arg[])
{
try
{

String userName="root";
String password="callno11";
String url="jdbc:mysql://localhost/test";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
cn = DriverManager.getConnection(url,userName,password);
smt = cn.createStatement();
rs = smt.executeQuery("select * from stud");
while(rs.next())
System.out.println(rs.getString(1));
}
catch(Exception e){System.out.println(e);}

}
}



I have set the path for mysl-connector.jar file
could anyone help me to solve this issue?
-Jegan

Options: ReplyQuote


Subject
Written By
Posted
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
September 02, 2005 03:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.