Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot Connect to Localhost?

843854Jul 10 2005 — edited Jul 10 2005
I have setup MySQL server on my computer and i am using JDBC for my Java application to connect to it but it doesn't allow me to. The error message is

==================================

java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?

==================================

details of the connection information are

private String url = "jdbc:mysql://localhost:3306/saloneasy";
private String driverName = "com.mysql.jdbc.Driver";
private String username = "root";

Class.forName(driverName);
connection = DriverManager.getConnection(url, username, password);
statement = connection.createStatement();

The JDBC drivers are being found, the code can attempt to access a mysql database running on a different computer, up to now access is denied, but the error message i am getting implies that the server isn't even running.

Both mysql > status; and MySQL Admin tool show the server to be running.

Any ideas?

The code i am using has worked in the past but i just cannot get this to work at the moment.

Dave
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 7 2005
Added on Jul 10 2005
2 comments
390 views