TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
aahh
Does anyone see anything wrong with this code? I echo my classpath and I
see the mysql_comp.jar in there, so I am guessing it is somethign else.
It is throwing a ClassNotFoundException.
this is the error::
Cannot load database driver
java.lang.ClassNotFoundException: org/gjt/mm/mysql/Driver
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at SmallProgram.main(SmallProgram.java:21)
here is a snippet
*****************************************************
public class SmallProgram extends Object {
private static Statement statement;
private static Connection connection;
private static String URL = "jdbc:mysql://foo";
private static DBManager manager;
public static void main ( String args[] ) {
try {
Class.forName("org.gjt.mm.mysql.Driver");
connection = DriverManager.getConnection( URL, "foo", "foo" );
statement = connection.createStatement();
manager = new DBManager(statement);
manager.setDebug(true);
}
catch (SQLException e) {
System.out.print("SQL Exception \n");
e.printStackTrace();
System.exit(1);
} catch (ClassNotFoundException e) {
System.out.print("Cannot load database driver \n");
e.printStackTrace();
System.exit(1);
} catch (Exception e) {
System.out.print("Exception in init\n");
e.printStackTrace();
System.exit(1);
}
}
*****************************************************************
Erick Stohr - PageLab Network, Inc.
mailto:erick@pagelab.net http://pagelab.net
Your search-to-sale global e-commerce solution!
Toll free 1-800-447-0607
Voice 612-362-9224
Fax 612-362-9227
43 Main Street SE, Suite 228
Minneapolis, Minnesota 55414
_______________________________________________