1 message in com.mysql.lists.javaNew issue with mm.mysql driver| From | Sent On | Attachments |
|---|---|---|
| Cavelle Benjamin | 23 Mar 2001 10:13 |
| Subject: | New issue with mm.mysql driver![]() |
|---|---|
| From: | Cavelle Benjamin (benj...@bellsouth.net) |
| Date: | 03/23/2001 10:13:54 AM |
| List: | com.mysql.lists.java |
All, thanks for the help earlier. I downloaded the latest version of the mm.mysql driver and I put the jar file in the jre/lib/ext/ directory, but I am still having problems. Any help would be great. I am just startng out with this, so please be patient with me. Thanks.
--------------------- Code:
--------------------- import java.sql.*;
public class DB { public static void main(String[] args) { String driver = "org.gjt.mm.mysql.Driver"; String protocal = "jdbc:mysql"; String host = "localhost"; String database = "mysql";
Connection con = null;
try { Class.forName(driver).newInstance(); } catch(Exception e) { e.printStackTrace(); }
String url = protocal + "://" + host + "/" + database;
try { con = DriverManager.getConnection(url, args[0], args[1]); System.out.println("Connection Successful! Closing ..."); con.close(); } catch(SQLException e) { e.printStackTrace(); } } }
------------------------------ Error:
------------------------------ java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at DB.main(DB.java:16) java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at DB.main(DB.java:27)
---------------------------------------------
The best spice is hunger! Anonymous




