I have been working on this for several weeks, and now I'm just running in circles. I get a runtime error: "class not found exception in [class] when receiving com.mysql.jdbc.Driver connection".
The connection function is as follows:
private static Connection getConnection() {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
System.err.println("class not found exception in [class] while getting connection " + e.getMessage());
} catch (SQLException e) {
System.err.println("sql exception in [class] while getting connection " + e.getMessage());
}
return con;
}
I installed a $CLASSPATHhundred times a hundred ways, and still no luck. It looks like this:
:/usr/share/java/mysql-connector-java-5.1.13-bin.jar:/usr/share/java/mysql-connector-java-3.0.17-ga-bin.jar:
Both of these files exist and contain the Driver.class file in the right place.
I even tried to import the class into my code before exporting the jar, but this caused a world of other problems.
I am using Eclipse 3.5.2 and the server runs Fedora 13 x86_64
Please, help.
edit: I run the code remotely on my server using the command: