Results 1 to 1 of 1
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 ,whole i have ...
- 03-17-2011 #1Just Joined!
- Join Date
- Mar 2011
- Posts
- 2
Help !! - com.mysql.jdbc.Driver class not found
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 ,whole 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........


Reply With Quote