Re: mysql-connector-java-3.1.8 problem



"David Harper" <devnull@xxxxxxxxxxxxxxxxxxx> wrote in message
news:xwI9e.13790
$DU6.9950@xxxxxxxxxxxxxxxxxxxxxxx

> What else do you have in your classpath?

Just "."

I keep getting stuck on this:

> All I have to do is make my CLASSPATH point to 3.1.8 and the error occurs,
> if I make it point to 3.1.7, no error.

If the ONLY change I make is to move from 3.1.7 to 3.1.8, what else is there
for me to suspect BUT version 3.1.8? Quite literally, all I do is change a
"7" to an "8" in my CLASSPATH and I get the error. Change the "8" back to
"7" and the error goes away.


Here is my test code:

// -------------------------------------------------------------------------
--

import java.sql.*;

public class MysqlTest {

/* this is used to connect to MySql */
private static final String m_DRIVER_STRING = "com.mysql.jdbc.Driver";
private static final String m_CONNECTION_STRING = "jdbc:mysql:///";

private static final String m_USER_ID = "myUserId";
private static final String m_PWD = "myPwd";

/* the dbase connection object */
private static Connection m_con = null;

/* used to send a statement to the dbase */
/* initialized in connect() */
private static Statement m_stmt;

/* CONNECT */
static private boolean connect() {
boolean success; /* true = all is well, dbase responding */

try {

/* load the driver for the database */
Class.forName(m_DRIVER_STRING);

// This uses TCP/IP to connect to MYSQL
m_con =
DriverManager.getConnection(m_CONNECTION_STRING,m_USER_ID,m_PWD);

/* if we were unable to connect to the database */
if(m_con.isClosed()) {
success = false;

/* connection successful */
} else {

/* create the statement object */
m_stmt = m_con.createStatement();
success = true;
}; /* endif */

} catch (ClassNotFoundException e) {
System.err.println("ClassNotFound Exception from dbase.java: " +
e.getMessage());
success = false;

} catch (LinkageError e) {
System.err.println("LinkageError Exception from dbase.java: " +
e.getMessage());
success = false;

} catch (Exception e) {
System.err.println("Exception Exception from dbase.java: " +
e.getMessage());
success = false;
} /* end try */

return success;

} /* end of method connect */

/* DESTROY */
static public void destroy() {

/* try to shut down the dbase connection */
try {
if(m_con != null) {
m_con.close();
m_con = null;
} /* endif */

} catch(SQLException e) {
/* do nothing */
} /* end try */

} /* end of procedure destroy */


/* MAIN */
public static void main(String args[]) {
ResultSet rs; /* results from dbase query */

if (connect())
{
try {
rs = m_stmt.executeQuery("SHOW DATABASES");
while (rs.next()) {
System.out.println("" + rs.getString(1));
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}

destroy();
}

} /* end of main */
}


.