Bug #375 Cant connect to database with name longer than 4 characters
Submitted: 6 May 2003 2:11 Modified: 6 May 2003 6:48
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.1.0-alpha OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[6 May 2003 2:11] [ name withheld ]
Description:
Using supplied class, I cannot make Connector J 3.1.0 connect to Mysql 4.1.0 alpha
Problem seems to be database name length.

How to repeat:
import java.sql.*;
/**
 * <p>Title: $Id: $</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: Synectics Systems Ltd</p>
 * @author $Author: $
 * @version $Revision: $
 */

public class MySQLConnector {

  public MySQLConnector() {
  }
  public static void main(String[] args) {
    MySQLConnector obj = new MySQLConnector();
    obj.connect();
  }

  public void connect() {
    try {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      java.sql.Connection conn;
      conn = DriverManager.getConnection(
          "jdbc:mysql://Hostname/synergy?user=xxxx&password=xxxx");
      System.out.println("OK");
    }
    catch (SQLException ex) {
      System.out.println(ex.getClass() + "  " + ex.getMessage());
    } catch (ClassNotFoundException ex) {
      System.out.println(ex.getClass() + "  " + ex.getMessage());
    } catch (IllegalAccessException ex) {
      System.out.println(ex.getClass() + "  " + ex.getMessage());
    } catch (InstantiationException ex) {
      System.out.println(ex.getClass() + "  " + ex.getMessage());
    }
  }
}

------------------------------

results in

class java.sql.SQLException  Communication failure during handshake. Message from server: "Unknown database 'syne'"

Change database to 'test' and it works fine.
[6 May 2003 6:48] Mark Matthews
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html
[6 May 2003 6:48] Mark Matthews
This is fixed in the nightly snapshots (has been for some time now). See http://mmmysql.sourceforge.net/snapshots/dev/