Anybody know what's wrong? After 'java LoadDriver'
I always get the message:

Exception: Communication link failure:
java.io.EOFException
SQLState:  08S01
VendorError: 0
java.sql.SQLException: Communication link failure:
java.io.EOFException
        at
org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:370)
        at
org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)

        at
org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)

        at
org.gjt.mm.mysql.Driver.connect(Driver.java:167)
        at
java.sql.DriverManager.getConnection(DriverManager.java:517)

        at
java.sql.DriverManager.getConnection(DriverManager.java:199)

        at LoadDriver.main(LoadDriver.java:20)


Information about the system I'm working on:
OS: Redhat Linux 2.2.17-6
DBMS: MySQL 3.23.11-alpha
Java:  jdk1.3
DB driver:  mm.mysql-2.0.4-bin.jar
CLASSPATH=/usr/java/jdk1.3/lib/mm.mysql-2.0.4-bin.jar:.

Compile: javac LoadDriver.java


Java code:
// LoadDriver.java
import java.sql.*;

public class LoadDriver {
    public static void main(String args[]) {
 // Load the driver to allow connection to the db
 try {

Class.forName("org.gjt.mm.mysql.Driver").newInstance();

 } catch (Exception e) {
     System.err.println("Failed to load JDBC/MySQL
driver");
     e.printStackTrace();
     System.exit(1);   // terminate the program
 }

 try {
     System.out.println("I'm going to connect to
database");
     Connection c =
DriverManager.getConnection("jdbc:mysql://localhost/test?user="

             + "nobody&password=nobody");
     System.out.println("I have connected to
database");
 }catch (SQLException e) {
     System.out.println("Exception: " +
e.getMessage());
     System.out.println("SQLState:  " +
e.getSQLState());
     System.out.println("VendorError: " +
e.getErrorCode());
     e.printStackTrace();
    }
  }
}

Thank you!



--
Cecilia


Reply via email to