Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

Unable to connect to MySQL database (no replies)

$
0
0
I installed MySql on Windows 7 and I put the Connector/J in the /lib/ext folder. I'm trying to connect to a database from Java, but I keep getting this error message:

"Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server."

This is my code:

Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/test",
"test_user", "password");
con.close();


How do I fix this?

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>