Functionality added or changed:
Usage Advisor will now issue warnings for result sets with large numbers of rows. You can configure the trigger value by using the
resultSetSizeThreshold
parameter, which has a default value of 100.The
rewriteBatchedStatements
feature can now be used with server-side prepared statements.Important change: Due to a number of issues with the use of server-side prepared statements, Connector/J 5.0.5 has disabled their use by default. The disabling of server-side prepared statements does not affect the operation of the connector in any way.
To enable server-side prepared statements you must add the following configuration property to your connector string:
useServerPrepStmts=true
The default value of this property is
false
(that is, Connector/J does not use server-side prepared statements).Improved speed of
datetime
parsing for ResultSets that come from plain or nonserver-side prepared statements. You can enable old implementation withuseFastDateParsing=false
as a configuration parameter.Usage Advisor now detects empty results sets and does not report on columns not referenced in those empty sets.
Fixed logging of XA commands sent to server, it is now configurable using
logXaCommands
property (defaults tofalse
).Added configuration property
localSocketAddress
, which is the host name or IP address given to explicitly configure the interface that the driver will bind the client side of the TCP/IP connection to when connecting.We've added a new configuration option
treatUtilDateAsTimestamp
, which isfalse
by default, as (1) We already had specific behavior to treat java.util.Date as a java.sql.Timestamp because it is useful to many folks, and (2) that behavior will very likely be required for drivers JDBC-post-4.0.
Bugs fixed:
Connection property
socketFactory
wasn't exposed using correctly named mutator/accessor, causing data source implementations that use JavaBean naming conventions to set properties to fail to set the property (and in the case of SJAS, fail silently when trying to set this parameter). (Bug#26326)A query execution which timed out did not always throw a
MySQLTimeoutException
. (Bug#25836)Storing a
java.util.Date
object in aBLOB
column would not be serialized correctly duringsetObject
. (Bug#25787)Timer instance used for
Statement.setQueryTimeout()
created per-connection, rather than per-VM, causing memory leak. (Bug#25514)EscapeProcessor
gets confused by multiple backslashes. We now push the responsibility of syntax errors back on to the server for most escape sequences. (Bug#25399)INOUT
parameters inCallableStatements
get doubly-escaped. (Bug#25379)When using the
rewriteBatchedStatements
connection option withPreparedState.executeBatch()
an internal memory leak would occur. (Bug#25073)Fixed issue where field-level for metadata from
DatabaseMetaData
when usingINFORMATION_SCHEMA
didn't have references to current connections, sometimes leading to Null Pointer Exceptions (NPEs) when introspecting them usingResultSetMetaData
. (Bug#25073)StringUtils.indexOfIgnoreCaseRespectQuotes()
isn't case-insensitive on the first character of the target. This bug also affectedrewriteBatchedStatements
functionality when prepared statements did not use uppercase for theVALUES
clause. (Bug#25047)Client-side prepared statement parser gets confused by in-line comments
/*...*/
and therefore cannot rewrite batch statements or reliably detect the type of statements when they are used. (Bug#25025)Results sets from
UPDATE
statements that are part of multi-statement queries would cause anSQLException
error, "Result is from UPDATE". (Bug#25009)Specifying
US-ASCII
as the character set in a connection to a MySQL 4.1 or newer server does not map correctly. (Bug#24840)Using
DatabaseMetaData.getSQLKeywords()
does not return a all of the of the reserved keywords for the current MySQL version. Current implementation returns the list of reserved words for MySQL 5.1, and does not distinguish between versions. (Bug#24794)Calling
Statement.cancel()
could result in a Null Pointer Exception (NPE). (Bug#24721)Using
setFetchSize()
breaks preparedSHOW
and other commands. (Bug#24360)Calendars and timezones are now lazily instantiated when required. (Bug#24351)
Using
DATETIME
columns would result in time shifts whenuseServerPrepStmts
was true. The reason was due to different behavior when using client-side compared to server-side prepared statements and theuseJDBCCompliantTimezoneShift
option. This is now fixed if moving from server-side prepared statements to client-side prepared statements by settinguseSSPSCompatibleTimezoneShift
totrue
, as the driver can't tell if this is a new deployment that never used server-side prepared statements, or if it is an existing deployment that is switching to client-side prepared statements from server-side prepared statements. (Bug#24344)Connector/J now returns a better error message when server doesn't return enough information to determine stored procedure/function parameter types. (Bug#24065)
A connection error would occur when connecting to a MySQL server with certain character sets. Some collations/character sets reported as "unknown" (specifically
cias
variants of existing character sets), and inability to override the detected server character set. (Bug#23645)Inconsistency between
getSchemas
andINFORMATION_SCHEMA
. (Bug#23304)DatabaseMetaData.getSchemas()
doesn't return aTABLE_CATALOG
column. (Bug#23303)When using a JDBC connection URL that is malformed, the
NonRegisteringDriver.getPropertyInfo
method will throw a Null Pointer Exception (NPE). (Bug#22628)Some exceptions thrown out of
StandardSocketFactory
were needlessly wrapped, obscuring their true cause, especially when using socket timeouts. (Bug#21480)When using a server-side prepared statement the driver would send timestamps to the server using nanoseconds instead of milliseconds. (Bug#21438)
When using server-side prepared statements and timestamp columns, value would be incorrectly populated (with nanoseconds, not microseconds). (Bug#21438)
ParameterMetaData
throwsNullPointerException
when prepared SQL has a syntax error. AddedgenerateSimpleParameterMetadata
configuration property, which when set totrue
will generate metadata reflectingVARCHAR
for every parameter (the default isfalse
, which will cause an exception to be thrown if no parameter metadata for the statement is actually available). (Bug#21267)Fixed an issue where
XADataSources
couldn't be bound into JNDI, as theDataSourceFactory
didn't know how to create instances of them.
Other changes:
Avoid static synchronized code in JVM class libraries for dealing with default timezones.
Performance enhancement of initial character set configuration, driver will only send commands required to configure connection character set session variables if the current values on the server do not match what is required.
Re-worked stored procedure parameter parser to be more robust. Driver no longer requires
BEGIN
in stored procedure definition, but does have requirement that if a stored function begins with a label directly after the "returns" clause, that the label is not a quoted identifier.Throw exceptions encountered during timeout to thread calling
Statement.execute*()
, rather thanRuntimeException
.Changed cached result set metadata (when using
cacheResultSetMetadata=true
) to be cached per-connection rather than per-statement as previously implemented.Reverted back to internal character conversion routines for single-byte character sets, as the ones internal to the JVM are using much more CPU time than our internal implementation.
When extracting foreign key information from
SHOW CREATE TABLE
inDatabaseMetaData
, ignore exceptions relating to tables being missing (which could happen for cross-reference or imported-key requests, as the list of tables is generated first, then iterated).Fixed some Null Pointer Exceptions (NPEs) when cached metadata was used with
UpdatableResultSets
.Take
localSocketAddress
property into account when creating instances ofCommunicationsException
when the underyling exception is ajava.net.BindException
, so that a friendlier error message is given with a little internal diagnostics.Fixed cases where
ServerPreparedStatements
weren't using cached metadata whencacheResultSetMetadata=true
was used.Use a
java.util.TreeMap
to map column names to ordinal indexes forResultSet.findColumn()
instead of a HashMap. This enables us to have case-insensitive lookups (required by the JDBC specification) without resorting to the many transient object instances needed to support this requirement with a normalHashMap
with either case-adjusted keys, or case-insensitive keys. (In the worst case scenario for lookups of a 1000 column result set, TreeMaps are about half as fast wall-clock time as a HashMap, however in normal applications their use gives many orders of magnitude reduction in transient object instance creation which pays off later for CPU usage in garbage collection).When using cached metadata, skip field-level metadata packets coming from the server, rather than reading them and discarding them without creating
com.mysql.jdbc.Field
instances.