| Bug #1152 | 4.1.0-Alpha and Connector/J 3.1.0-alpha truncates DBNAME passed on URL | ||
|---|---|---|---|
| Submitted: | 27 Aug 2003 9:42 | Modified: | 27 Aug 2003 9:48 |
| Reporter: | Brian Buchanan | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) |
| Version: | 4.1.0-Alpha and 3.1.0-Alpha | OS: | Windows (Windows) |
| Assigned to: | CPU Architecture: | Any | |
[27 Aug 2003 9:44]
Brian Buchanan
Java class demonstrating dbname truncation error
Attachment: TestDB2.java (application/octet-stream, text), 809 bytes.
[27 Aug 2003 9:48]
Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html
This was fixed quite some time ago in the source tree. Please see a snapshot build of Connector/J 3.1 from http://mmmysql.sourceforge.net/snapshots/dev/
[27 Aug 2003 11:00]
Brian Buchanan
Thanks. I only downloaded MySQL and Connector/J last Wednesday from http://www.mysql.com/downloads/mysql-4.1.html and http://www.mysql.com/downloads/api-jdbc-dev.html I didn't know you had anything newer available. I really got confused when I was reading articles in groups.google.com about a MySQL 4.1.1 but I couldn't find it in your downloads section. I felt I was missing something, and I guess the bitmover and sourceforge sites are it. Thanks.

Description: Tried to connect via JDBC, with the url jdbc:mysql://10.1.8.2:3306/database2?user=dbuser&password=dbuser Error back from the server is : SQLException: Communication failure during handshake. Message from server: "Access denied for user: 'dbuser@c2687.interfast.ca' to database 'data'" notice that database2 has been truncated to 'data'. Always 4 characters must test with machine's IP address, as using 127.0.0.1 or localhost generates a different error: SQLException: Communication link failure: java.io.IOException, under lying cause: Unexpected end of input stream How to repeat: mysql -u root create database database2; grant all priviledges on database2 to dbuser identified by dbuser; \q create java class test\TestDB2.java: package test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class TestDB2 { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql://10.1.8.2:3306/database2?user=dbuser&password=dbuser"); conn.close(); } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } catch (Exception ex) { System.out.println("Error"); ex.printStackTrace(); } } } replace 10.1.8.2 with your machine IP as using localhost or 127.0.0.1 generates a different error as mentioned above. Suggested fix: Work around is to not specify the dbname on the url, and call setCatalog(String a) on the connection. Otherwise, I'm not sure what is truncating the dbname, whethere it's the Connector/J or the DB, but as I can connect from mysql and from perl, it's probably Connector/J.