-   Programming (
-   -   Java JDBC-Exception: Communications link failure (

Swift&Smart 12-05-2007 10:02 PM

Java JDBC-Exception: Communications link failure

Recently,I have been playing around with Java and JDBC using MySQL database,which is my favourite.However,after I put the mysql-connector...jar to my JDK installation location /usr/local/jdk1.6/jre/lib/ext/.jar and I used the sample script on the Internet and try to connect to,it returned a failure message.

Exception: Communications link failure in the command prompt

Please drop me a line if you have any ideas with this error.Thanks a million.

The sample script goes like:

import java.sql.*;
public class MySqlConnectionUrl {
  public static void main(String [] args) {
    Connection con = null;
    try {
      Class.forName("com.mysql.jdbc.Driver") ;
      System.out.println("MySQL JDBC driver loaded ok.");
      con = DriverManager.getConnection(
        + "user=user&password=mypasswd");
      System.out.println("Connected with host:port/database.");
    catch (Exception e) {
      System.err.println("Exception: "+e.getMessage());

ehawk 12-06-2007 12:12 AM

Does starting to read from here help?

Perhaps you can post to the java forum above

Also see (perhaps another good forum to consider):

All times are GMT -5. The time now is 04:10 AM.