java and mysql connection difficulties
In SUSE linux I'm trying to establish a connection with MySQL within a java program. First, I tried to get the following code running: public class test { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); System.out.println("Good to go"); } catch (Exception E) { System.out.println("JDBC Driver error"); } } } When I ran this it just gave me the JDBC Driver error. I tried more detailed code and when I print out the SQLException E.getMessage I just get: No suitable driver I've tried different combinations of things include setting the $CLASSPATH variable to point to the connector, but it says NO SUCH FILE OR DIRECTORY when I do (even though I see the file in the directory ). If anyone has been able to do this in Suse I would appreciate any tips. Thanks.
Last edited by mrj; 07-02-2007 at 04:18 PM.
|