JDBC-MySQL error message "No suitable driver" ??
Posted by:
kristofm
Date: September 07, 2004 03:08PM
I'm trying to get Java connect to Mysql but I keep getting the error message: 'No suitable driver'.
Here's what I've installed and done:
j2sdk-1_4_2_05-windows-i586-p.exe
j2re-1_4_2_05-windows-i586-p.exe
mysql-4.0.20d-win.zip
mysql-connector-java-3.0.15-ga.zip
I copied mysql-connector-java-3.0.15-ga-bin.jar in jre/lib/ext directory)
I'm trying to connect to a MySQL database 'myhotels' using an example program I found on the Internet. I'm using XP pro and MySQL server is runnnig in a DOS-box using mysqld --console
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:myhotel",
"root", "test");
if(!con.isClosed())
myLabel.setText("Successfully connected to " +
"MySQL server using TCP/IP...");
}
catch(Exception e)
{
myLabel.setText("Error: "+e.getMessage());
}
Anyone have any idea what's going wrong? Any help you could offer would be much appreciated!
Subject
Written By
Posted
JDBC-MySQL error message "No suitable driver" ??
September 07, 2004 03:08PM
September 07, 2004 08:04PM
September 08, 2004 01:59AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.