Skip navigation links

MySQL Forums :: Connector/JDBC and Java :: Help !! - com.mysql.jdbc.Driver class not found


Advanced Search

Help !! - com.mysql.jdbc.Driver class not found
Posted by: rohit singh ()
Date: March 17, 2011 05:51AM

i am working on fedora 14 and get an error while making an database connection with java to mysql . The Exception is com.mysql.jdba.Driver class not found ,while i have put the "mysql-connector-java-5.1.15-bin.jar" in /home/Rohit/apache-tomcat-6.0.26/lib folder of Apache tomcat Server.

this is code :-



import java.sql.*;



public class Login extends Connect

{

HashMap login_data;

public Login()

{

Connect.mysql_connect();

}





public HashMap login(HashMap login_data)

{



String luser=null,lpassword=null;

String user=null,password=null;

luser=(String) login_data.get("lid");

lpassword=(String) login_data.get("lpass");

try {





rs=statement.executeQuery("SELECT * FROM login where user='"+luser+"'") ;



while(rs.next())

{



user=rs.getString("user");

password=rs.getString("pass");

}



}catch(Exception jk) { System.out.println("error : " + jk);}



if(user.equals(luser) && password.equals(lpassword))

return login_data;







}


this is code of project where error occur.

package com;
import java.sql.*;

public class Connect {
public static Statement statement=null;
public static Connection connection=null;
public static ResultSet rs=null;
public static PreparedStatement psmt=null;
public static void mysql_connect()
{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection=DriverManager.getConnection("jdbc:mysql://localhost/HCL?" +"user=root&pass=toor");
statement=connection.createStatement();
}
catch(Exception e)
{
System.out.print("Error in Connect file" +e.toString());
}
}



} this is code of connection class .


plz help to make connection i am in trouble from 1 week.

thanks in advance........

Options: ReplyQuote


Subject Written By Posted
Help !! - com.mysql.jdbc.Driver class not found rohit singh 03/17/2011 05:51AM
Re: Help !! - com.mysql.jdbc.Driver class not found Gerard Matte 03/17/2011 11:06AM


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.