My Oracle Support Banner

Connector/J 5.1.16 Errors when URL Contains Session Variables and UTF8 Character Encoding (Doc ID 1330795.1)

Last updated on MARCH 08, 2017

Applies to:

MySQL Connectors - Version: 5.1 and later   [Release: 5.1 and later ]
Information in this document applies to any platform.


On : 5.1 version, Connector/J version 5.1.16

When attempting to connect via JDBC with both UTF8 character encoding and SESSION variables set in the connection string such as:


the follow error occurs:

Caused by: java.lang.NullPointerException
at com.mysql.jdbc.ConnectionImpl.getServerCharacterEncoding(
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
at com.mysql.jdbc.ConnectionImpl.execSQL(
... 18 more
SQLException: Unexpected exception encountered during query.
SQLState: S1000

This issue can be reproduced with the following steps:
  1. Create a connection string for Connector/J defining both session variables and UTF8 character encoding.
  2. Attempt to open the connection to MySQL.

The issue has the following business impact:
Users cannot connect to the MySQL server using all the capabilities they employed in the previous versions. Involves waiting for patch or changing application code to get a working connection.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.