Functionality added or changed:
Multiple result sets were not supported when using streaming mode to return data. Both normal statements and the resul sets from stored procedures now return multiple results sets, with the exception of result sets using registered
OUTPUT
paramaters. (Bug#33678)XAConnections and datasources have been updated to the JDBC-4.0 standard.
The profiler event handling has been made extensible using the
profilerEventHandler
connection property.Add the
verifyServerCertificate
propery. If set to "false" the driver will not verify the server's certificate whenuseSSL
is set to "true"When using this feature, the keystore parameters should be specified by the
clientCertificateKeyStore*
properties, rather than system properties, as the JSSE doesn't it straightforward to have a nonverifying trust store and the "default" key store.
Bugs fixed:
DatabaseMetaData.getColumns()
returns incorrectCOLUMN_SIZE
value forSET
column. (Bug#36830)When trying to read
Time
values like “00:00:00” withResultSet.getTime(int)
an exception is thrown. (Bug#36051)JDBC connection URL parameters is ignored when using
MysqlConnectionPoolDataSource
. (Bug#35810)When
useServerPrepStmts=true
and slow query logging is enabled, the connector throws aNullPointerException
when it encounters a slow query. (Bug#35666)When using the keyword “loadbalance” in the connection string and trying to perform load balancing between two databases, the driver appears to hang. (Bug#35660)
JDBC data type getter method was changed to accept only column name, whereas previously it accepted column label. (Bug#35610)
Prepared statements from pooled connections caused a
NullPointerException
whenclosed()
under JDBC-4.0. (Bug#35489)In calling a stored function returning a
bigint
, an exception is encountered beginning:java.sql.SQLException: java.lang.NumberFormatException: For input string:
followed by the text of the stored function starting after the argument list. (Bug#35199)
The JDBC driver uses a different method for evaluating column names in
resultsetmetadata.getColumnName()
and when looking for a column inresultset.getObject(columnName)
. This causes Hibernate to fail in queries where the two methods yield different results, for example in queries that use alias names:SELECT column AS aliasName from table
MysqlConnectionPoolDataSource
does not supportReplicationConnection
. Notice that we implementedcom.mysql.jdbc.Connection
forReplicationConnection
, however, only accessors from ConnectionProperties are implemented (not the mutators), and they return values from the currently active connection. All other methods fromcom.mysql.jdbc.Connection
are implemented, and operate on the currently active connection, with the exception ofresetServerState()
andchangeUser()
. (Bug#34937)ResultSet.getTimestamp()
returns incorrect values for month/day ofTIMESTAMP
s when using server-side prepared statements (not enabled by default). (Bug#34913)RowDataStatic
does't always set the metadata inResultSetRow
, which can lead to failures when unpackingDATE
,TIME
,DATETIME
andTIMESTAMP
types when using absolute, relative, and previous result set navigation methods. (Bug#34762)When calling
isValid()
on an active connection, if the timeout is nonzero then theConnection
is invalidated even if theConnection
is valid. (Bug#34703)It was not possible to truncate a
BLOB
usingBlog.truncate()
when using 0 as an argument. (Bug#34677)When using a cursor fetch for a statement, the internal prepared statement could cause a memory leak until the connection was closed. The internal prepared statement is now deleted when the corresponding result set is closed. (Bug#34518)
When retrieving the column type name of a geometry field, the driver would return
UNKNOWN
instead ofGEOMETRY
. (Bug#34194)Statements with batched values do not return correct values for
getGeneratedKeys()
whenrewriteBatchedStatements
is set totrue
, and the statement has anON DUPLICATE KEY UPDATE
clause. (Bug#34093)The internal class
ResultSetInternalMethods
referenced the nonpublic classcom.mysql.jdbc.CachedResultSetMetaData
. (Bug#33823)A
NullPointerException
could be raised when using client-side prepared statements and enabled the prepared statement cache using thecachePrepStmts
. (Bug#33734)Using server side cursors and cursor fetch, the table metadata information would return the data type name instead of the column name. (Bug#33594)
ResultSet.getTimestamp()
would throw aNullPointerException
instead of aSQLException
when called on an emptyResultSet
. (Bug#33162)Load balancing connection using best response time would incorrectly "stick" to hosts that were down when the connection was first created.
We solve this problem with a black list that is used during the picking of new hosts. If the black list ends up including all configured hosts, the driver will retry for a configurable number of times (the
retriesAllDown
configuration property, with a default of 120 times), sleeping 250ms between attempts to pick a new connection.We've also went ahead and made the balancing strategy extensible. To create a new strategy, implement the interface
com.mysql.jdbc.BalanceStrategy
(which also includes our standard "extension" interface), and tell the driver to use it by passing in the class name using theloadBalanceStrategy
configuration property. (Bug#32877)During a Daylight Savings Time (DST) switchover, there was no way to store two timestamp/datetime values , as the hours end up being the same when sent as the literal that MySQL requires.
Note that to get this scenario to work with MySQL (since it doesn't support per-value timezones), you need to configure your server (or session) to be in UTC, and tell the driver not to use the legacy date/time code by setting
useLegacyDatetimeCode
to "false". This will cause the driver to always convert to/from the server and client timezone consistently.This bug fix also fixes Bug#15604, by adding entirely new date/time handling code that can be switched on by
useLegacyDatetimeCode
being set to "false" as a JDBC configuration property. For Connector/J 5.1.x, the default is "true", in trunk and beyond it will be "false" (that is, the old date/time handling code will be deprecated) (Bug#32577, Bug#15604)When unpacking rows directly, we don't hand off error message packets to the internal method which decodes them correctly, so no exception is raised, and the driver than hangs trying to read rows that aren't there. This tends to happen when calling stored procedures, as normal SELECTs won't have an error in this spot in the protocol unless an I/O error occurs. (Bug#32246)
When using a connection from
ConnectionPoolDataSource
, someConnection.prepareStatement()
methods would return null instead of the prepared statement. (Bug#32101)Using
CallableStatement.setNull()
on a stored function would throw anArrayIndexOutOfBounds
exception when setting the last parameter to null. (Bug#31823)MysqlValidConnectionChecker
doesn't properly handle connections created usingReplicationConnection
. (Bug#31790)Retrieving the server version information for an active connection could return invalid information if the default character encoding on the host was not ASCII compatible. (Bug#31192)
Further fixes have been made to this bug in the event that a node is nonresponsive. Connector/J will now try a different random node instead of waiting for the node to recover before continuing. (Bug#31053)
ResultSet
returned byStatement.getGeneratedKeys()
is not closed automatically when statement that created it is closed. (Bug#30508)DatabaseMetadata.getColumns()
doesn't return the correct column names if the connection character isn't UTF-8. A bug in MySQL server compounded the issue, but was fixed within the MySQL 5.0 release cycle. The fix includes changes to all the sections of the code that access the server metadata. (Bug#20491)Fixed
ResultSetMetadata.getColumnName()
for result sets returned fromStatement.getGeneratedKeys()
- it was returning null instead of "GENERATED_KEY" as in 5.0.x.