MySQL Forums
Forum List  »  Microsoft SQL Server

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Posted by: Alex Burno
Date: March 16, 2006 07:57AM

hi im new to mysql i have installed mysql and mysql-front tool and i write a simport java.sql.*;
import java.io.*;
class emisdb
{


public static void main(String args[])
{
Connection con=null;
Statement Datarequest;
String url="jdbc:mysql://localhost:3306/emisdb";
String dbdriver="com.mysql.jdbc.Driver";

try{

Class.forName(dbdriver);
con=DriverManager.getConnection(url,"root"," ");
}
catch(ClassNotFoundException error)
{
System.out.println("Unable to load the jdbc mysql bridge"+error);
}
catch(SQLException error)
{
System.out.println("Sql error"+error);

}

try{

String query="INSERT INTO emisdb"+"VALUES('arun',23)";
Datarequest=con.createStatement();
Datarequest.executeUpdate(query);
Datarequest.close();

}
catch(SQLException er)
{
System.out.println("SQL ERROR"+er);
if(con!=null)
{
try
{

con.close();
}
catch(SQLException err)
{

}
}
}
}
}
simple java program as this but i can compile that but i couldnt execute that eventhough i have download mysql-connector-java-3.1.12-ga-binRAR file in the j2sdk1.4.2/lib folder
please help to get this thing sort it out

Options: ReplyQuote


Subject
Written By
Posted
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
March 16, 2006 07:57AM


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.