MySQL Java hell

AFB

Lifer
Jan 10, 2004
10,718
3
0
I put the driver in the lib\ext\ folder, no luck - class not found when trying to get the class.
I try setting the class path to the jar - ditto
I try setting it to the folders - same.


This is begining to suck.

Code:
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Loaded driver");

It never prints that statement, always throws exception.

Thanks:)
 

Kilrsat

Golden Member
Jul 16, 2001
1,072
0
0
ok, I have the following files in one folder:

BeerTrackerServer.java
ClientHandler.java
mysql-connector-java-3.1.7-bin.jar

The client handler uses the MySQL JDBC driver using Class.forName("com.mysql.jdbc.Driver"), just like you're trying.

To compile it, I change to the folder and enter this command:
javac -classpath mysql-connector-java-3.1.7-bin.jar;. *.java

To run it:
java -classpath mysql-connector-java-3.1.7-bin.jar;. BeerTrackerServer

Done.
 

AFB

Lifer
Jan 10, 2004
10,718
3
0
Originally posted by: Kilrsat
ok, I have the following files in one folder:

BeerTrackerServer.java
ClientHandler.java
mysql-connector-java-3.1.7-bin.jar

The client handler uses the MySQL JDBC driver using Class.forName("com.mysql.jdbc.Driver"), just like you're trying.

To compile it, I change to the folder and enter this command:
javac -classpath mysql-connector-java-3.1.7-bin.jar;. *.java

To run it:
java -classpath mysql-connector-java-3.1.7-bin.jar;. BeerTrackerServer

Done.

:),but a pain in the ass.

THX :beer: