2007.03.02

MySQL

MySQL Connector/J 5.0.5がリリースされました。

オリジナル版:http://lists.mysql.com/java/9035

MySQL Connector/J 5.0.5(MySQL用のタイプ4のpure-Java JDBCドライバの最新バージョン)が リリースされました。

これはConnector/Jの現在の商品版におけるバグ修正リリースです。

バージョン5.0.5は、MySQL-4.1、MySQL-5.0、MySQL-5.1ベータ版、MySQL-5.2ファルコンプレビュー用を含んだいくつかのMySQLのバージョンでの使用にふさわしいリリースです。

バージョン5.0.5は、http://dev.mysql.com/downloads/connector/j/5.0.htmlおよびミラーサイトのConnector/Jダウンロードページからソースおよびバイナリ形式で入手可能です。(すべてのミラーサイトが現在において最新であるとは限らないかもしれないことに注意してください。あるミラーサイトでこのバージョンを見つけることができない場合は、再度確認を行うか、あるいは別のダウンロード・サイトを選択してください。)

いつものことですが、アプリケーションに影響を及ぼす動作変更を把握するには、アップグレードの前に、マニュアルの変更ログ(http://dev.mysql.com/doc/refman/5.0/en/cj-news.html)と"Upgrading"の節(http://dev.mysql.com/doc/refman/5.0/en/cj-upgrading.html)をチェックするようお勧めします。

以下はこのリリースのパフォーマンス改善、機能の追加および変更情報です。

Performance Improvements:

* Improved speed of datetime parsing for ResultSets that come from plain or
non-server-side prepared statements. If any regressions are noticed, you can enable the
old implementation with useFastDateParsing=false as a configuration parameter.

* 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.

* Changed cached result set metadata (when using cacheResultSetMetadata=true) to be cached
per-connection rather than per-statement as previously implemented.

* Use a java.util.TreeMap to map column names to ordinal indexes for
ResultSet.findColumn() instead of a HashMap. This allows 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 normal HashMap 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).

* Avoid static synchronized code in JVM class libraries for dealing with default
timezones.

* Fixed cases where ServerPreparedStatements weren't using cached metadata when
cacheResultSetMetadata=true was used.

* 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.

Functionality added or changed:

* Important change: Due to a number of issues with the server's implementation 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, except for the case where the connection was configured with
"useTimezone=true". If so, see the bugfix note for "useSSPSCompatibleTimezoneShift".

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 (i.e. Connector/J does not use server-side
prepared statements, and won't until they've matured). If you have an application that
already works well with server-side prepared statements, it is reasonable to enable them.


* The rewriteBatchedStatements feature can now be used with server-side prepared
statements.

* Usage Advisor now detects empty results sets and does not report on columns not
referenced in those empty sets.

* 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.

* Added configuration property localSocketAddress,which is the hostname 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 is false by
default, as (1) We already had specific behavior to treat java.util.Date as a
java.sql.Timestamp because it's useful to many folks, and (2) that behavior will very
likely be required for drivers JDBC-post-4.0.

* Fixed logging of XA commands sent to server, it's now configurable via logXaCommands
property (defaults to false).

Bugs fixed:

* Fixed an issue where XADataSources couldn't be bound into JNDI, as the DataSourceFactory
didn't know how to create instances of them.

* Calling Statement.cancel() could result in a Null Pointer Exception (NPE). (Bug#24721)

* Calendars and timezones are now lazily instantiated when required. (Bug#24351)

* 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)

* When using a JDBC connection URL that is malformed, the
NonRegisteringDriver.getPropertyInfo() method will throw a Null Pointer Exception (NPE).
(Bug#22628)

* 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)


* Specifying US-ASCII as the character set in a connection to a MySQL 4.1 or newer server
does not map correctly. (Bug#24840) Storing a java.util.Date object in a BLOB column
would not be serialized correctly during setObject. (Bug#25787)

* A query execution which timed out did not always throw a MySQLTimeoutException.
(Bug#25836)

* 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)

* Using setFetchSize() breaks prepared SHOW and other commands. (Bug#24360)

* Using DATETIME columns would result in time shifts when useServerPrepStmts was true. The
reason was due to different behavior when using client-side compared to server-side
prepared statements and the

* useJDBCCompliantTimezoneShift option. This is now fixed if moving from server-side
prepared statements to client-side prepared statements by setting
useSSPSCompatibleTimezoneShift to true, 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)

* Inconsistency between getSchemas and INFORMATION_SCHEMA. (Bug#23304) When using the
rewriteBatchedStatements connection option with PreparedState.executeBatch() an internal
memory leak would occur. (Bug#25073)

* Fixed issue where field-level for metadata from DatabaseMetaData when using
INFORMATION_SCHEMA didn't have references to current connections, sometimes leading to
Null Pointer Exceptions (NPEs) when introspecting them via ResultSetMetaData.

* Connector/J now returns a better error message when server doesn't return enough
information to determine stored procedure/function parameter types. (Bug#24065)

* When using server-side prepared statements and timestamp columns, value would be
incorrectly populated (with nanoseconds, not microseconds). (Bug#21438)

* Timer instance used for Statement.setQueryTimeout() created per-connection, rather than
per-VM, causing memory leak. (Bug#25514)

* Results sets from UPDATE statements that are part of multi-statement queries would cause
an SQLException error, "Result is from UPDATE". (Bug#25009)

* StringUtils.indexOfIgnoreCaseRespectQuotes() isn't case-insensitive on the first
character of the target. This bug also affected rewriteBatchedStatements functionality
when prepared statements did not use uppercase for the VALUES clause. (Bug#25047)

* Some exceptions thrown out of StandardSocketFactory were needlessly wrapped, obscuring
their true cause, especially when using socket timeouts. (Bug#21480)

* DatabaseMetaData.getSchemas() doesn't return a TABLE_CATALOG column. (Bug#23303)

* 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 in CallableStatements get doubly-escaped. (Bug#25379)

* Connection property socketFactory wasn't exposed via 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 Sun Java Application Server,
fail silently when trying to set this parameter). (Bug#26326)

* ParameterMetaData throws NullPointerException when prepared SQL actually has a syntax
error. Added generateSimpleParameterMetadata configuration property, which when set to
true will generate metadata reflecting VARCHAR for every parameter (the default is false,
which will cause an exception to be thrown if no parameter metadata for the statement is
actually available). (Bug#21267)

- --------------
Other changes:
- --------------

* 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 caused due to statement timeout to the thread calling
Statement.execute*() on the statement that timed out, rather than a RuntimeException.

* Take localSocketAddress property into account when creating instances of
CommunicationsException when the underyling exception is a java.net.BindException, so
that a friendlier error message is given with a little internal diagnostics.

* Fixed some Null Pointer Exceptions (NPEs) when cached metadata was used with
UpdatableResultSets.

* When extracting foreign key information from SHOW CREATE TABLE in DatabaseMetaData,
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).