Hi,
This is how we can connect JDBC to mysql
// loads the JDBC driver
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
// get a database connection
Connection conn = DriverManager.getConnection(
"jdbc:mysql://hostname/databaseName",
"user",
"password");
obviously the JDBC driver "org.gjt.mm.mysql.Driver" must be in classpath. You can download it from
http://www.mysql.com/downloads/api-jdbc.html
Hope this wil help you.
Anil.
Developer Technical Support.
Sun Microsystems
http://www.sun.com/developers/support
Java can't find the driver in your classpath. You should have a file named "mysql.jar" or something similar. This needs to be put in the CLASSPATH environment variable. Note that regular class files can be found using only a directory path, but jar files must be explicitly named. In other words,if the jar file is in /usr/local/java/lib, then you must put
"/usr/local/java/lib/mysql.jar"
in your classpath, not just
"/usr/local/java/lib"