Bug #61201 | Can't establish connection when url has sessionVariables and characterEncoding | ||
---|---|---|---|
Submitted: | 17 May 2011 13:46 | Modified: | 18 Jul 2011 15:04 |
Reporter: | Arthur Du | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | 5.1.16 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | sessionVariables characterEncoding |
[17 May 2011 13:46]
Arthur Du
[20 May 2011 13:03]
Tonci Grgin
Hi Arthur and thanks for your report. True, there is a problem in MySQLIO.java, ln ~2095 if (characterEncoding != null) { if (this.platformDbCharsetMatches) { this.sendPacket.writeStringNoNull(query, characterEncoding, this.connection.getServerCharacterEncoding(), this.connection.parserKnowsUnicode(), this.connection); since this.connection.getServerCharacterEncoding() seems not to be initialized yet and by defining characterEncoding you are bound to enter this if.
[31 May 2011 23:50]
Brian Craft
Can verify that we are encountering this bug when using Atlassian Confluence and Jira with tomcat 6.0.32 and the URL - url="jdbc:mysql://<host>:3306/jira_next?autoReconnect=true&useUnicode=true&characterEncoding=utf8&sessionVariables=storage_engine=InnoDB" ... 51 more Caused by: java.lang.NullPointerException at com.mysql.jdbc.ConnectionImpl.getServerCharacterEncoding(ConnectionImpl.java:3100) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2095) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2619) ... 56 more
[18 Jul 2011 15:04]
Tonci Grgin
Patch is pushed to revision 1077 but only for 4.1+ servers.
[22 Jul 2011 8:58]
Tonci Grgin
Additional changes pushed up to revision 1079. Server character set is determined from handshake rather than by parsing server variables.
[30 Sep 2011 1:59]
Philip Olson
Changelog entry for 5.1.18: + A connection could not be established when the + <acronym>URL</acronym> + contained both <literal>sessionVariables</literal> and + <literal>characterEncoding</literal>.