Here is my DBHandler class for getting the connection
/////////////////////////////////////////////
public class DBHandler {
private
String dbClass="org.gjt.mm.mysql.Driver";
// .jar file for driver added to classpath
private String dbURL="jdbc:mysql://localhost:3306/dbName?user=admin&password=admin";
private Connection dbCon;
/** Creates a new instance of DBHandler */
public DBHandler() {
}
public java.sql.Connection getDbConnection()throws SQLException {
try{
Class.forName(dbClass).newInstance();
dbCon= DriverManager.getConnection(dbURL);
}catch(ClassNotFoundException e){
System.out.println("null Connection");
}catch(Exception e){
dbCon=null;
System.out.println("Instantiation or General Exception "+e.getMessage());
}
return dbCon;
}
public void close(java.sql.Connection con)throws SQLException{
try{
con.close();
}catch(SQLException e){System.out.println("Unable to Close the Connection");}
}
}
/////////////////////////////////////////////////////////
Each time i try to access DBHandler.getDbConnection it gives me the classnotfound exception.
I just checked my database out, and i hope u believe me that at database level all the data is updated and inserted but still my class throws a ClassNotFoundException. and i have no ideawhats going on here, coz it shouldnt be able to access the database if the connection is null:
[ September 20, 2003: Message edited by: pervaiz gul ]