2007.05.16

MySQL

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

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

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

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

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

バージョン5.0.6は、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)をチェックするようお勧めします。

バグレポート、バグ修正、パッチ等の情報をお待ちしておりますので、以下のページをご利用ください。

http://forge.mysql.com/wiki/Contributing

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

- -------------------------
Performance Improvements
- -------------------------

- - FixedBUG#27655- Connection.getTransactionIsolation() uses "SHOW VARIABLES LIKE"
which is very inefficient on MySQL-5.0+
 
- - More intelligent initial packet sizes for the "shared" packets are used (512 bytes,
rather than 16K), and initial packets used during handshake are now sized appropriately
as to not require reallocation.

- - Added an experimental load-balanced connection designed for use with SQL nodes in a
MySQL Cluster/NDB environment (This is not for master-slave replication. For that, we
suggest you look at ReplicationConnection or "lbpool").
 
If the JDBC URL starts with "jdbc:mysql:loadbalance://host-1,host-2,...host-n", the driver
will create an implementation of java.sql.Connection that load balances requests across a
series of MySQL JDBC connections to the given hosts, where the balancing takes place
after transaction commit.

Therefore, for this to work (at all), you must use transactions, even if only reading
data.

Physical connections to the given hosts will not be created until needed.
     
The driver will invalidate connections that it detects have had communication errors when
processing a request. A new connection to the problematic host will be attempted the next
time it is selected by the load balancing algorithm.
     
There are two choices for load balancing algorithms, which may be specified by the
"loadBalanceStrategy" JDBC URL configuration property:
     
      * "random" - the driver will pick a random host for each request. This tends to work
better than round-robin, as the randomness will somewhat account for spreading loads where
requests vary in response time, while round-robin can sometimes lead to overloaded nodes
if there are variations in response times across the workload.
       
      * "bestResponseTime" - the driver will route the request to the host that had the
best response time for the previous transaction.
       
- - When "useLocalSessionState" is set to "true" and connected to a MySQL-5.0 or later
server, the JDBC driver will now determine whether an actual "commit" or "rollback"
statement needs to be sent to the database when Connection.commit() or
Connection.rollback() is called.
     
This is especially helpful for high-load situations with connection pools that always call
Connection.rollback() on connection check-in/check-out because it avoids a round-trip to
the server.

- - Driver will now use INSERT INTO ... VALUES (DEFAULT) form of statement for updatable
result sets for ResultSet.insertRow(), rather than pre-populating the insert row with
values from DatabaseMetaData.getColumns() (which results in a "SHOW FULL COLUMNS" on the
server for every result set). If an application requires access to the default values
before insertRow() has been called, the JDBC URL should be configured with
"populateInsertRowWithDefaultValues" set to "true".
 
This fix specifically targets performance issues with ColdFusion and the fact that it
seems to ask for updatable result sets and touch the insert row no matter what the
application does with them.

- - Added configuration property "useDynamicCharsetInfo". If set to "false" (the default),
the driver will use a per-connection cache of character set information queried from the
server when necessary, or when set to "true", use a built-in static mapping that is more
efficient, but isn't aware of  custom character sets or character sets implemented after
the release of the JDBC driver.
 
  Note: this only affects the "padCharsWithSpace" configuration property and the        
ResultSetMetaData.getColumnDisplayWidth() method.

- ----------------------
Usability Improvements
- ----------------------

- - Give better error message when "streaming" result sets, and the connection gets
clobbered because of exceeding net_write_timeout on the server. (which is basically what
the error message says too).

- - FixedBUG#27317- ResultSet.get*() with a column index < 1 returns  misleading
error message.

- - com.mysql.jdbc.[NonRegistering]Driver now understands URLs of the format
"jdbc:mysql:replication://" and "jdbc:mysql:loadbalance://" which will create a
ReplicationConnection (exactly like when using [NonRegistering]ReplicationDriver) and an
experimenal load-balanced connection designed for use with SQL nodes in a MySQL
Cluster/NDB environment, respectively.
 
In an effort to simplify things, we're working on deprecating multiple drivers, and
instead specifying different core behavior based upon JDBC URL prefixes, so watch for
[NonRegistering]ReplicationDriver to eventually disappear, to be replaced with
com.mysql.jdbc[NonRegistering]Driver with the new URL prefix.

- - FixedBUG#28085- Generate more useful error messages for diagnostics when the driver
thinks a result set isn't updatable. (Thanks to Ashley Martens for the patch).

- -----------------
Defects Addressed
- -----------------

- - FixedBUG#25545- Client options not sent correctly when using SSL, leading to stored
procedures not being able to return results. Thanksto Don Cohen for the bug report,
testcase and patch.

- - FixedBUG#26592- PreparedStatement is not closed in BlobFromLocator.getBytes().

- - FixedBUG#25624- Whitespace surrounding storage/size specifiers in stored procedure
parameters declaration causes NumberFormatException to be thrown when calling stored
procedure on JDK-1.5 or newer, as the Number classes in JDK-1.5+ are whitespace
intolerant.  
 
- - FixedBUG#26173- When useCursorFetch=true, sometimes server would return new, more
exact metadata during the execution of the server-side prepared statement that enables
this functionality, which the driver ignored (using the original metadata returned during
prepare()), causing corrupt reading of data due to type mismatch when the actual rows were
returned.

- - FixedBUG#26959- comments in DDL of stored procedures/functions confuse procedure
parser, and thus metadata about them can not be created, leading to inability to retrieve
said metadata, or execute procedures that have certain comments in them.

- - FixedBUG#26789- fast date/time parsing doesn't take into account 00:00:00 as a legal
value.

- - FixedBUG#25517- Statement.setMaxRows() is not effective on result sets materialized
from cursors.
 
- - New configuration property, "enableQueryTimeouts" (default "true"). When enabled,
query timeouts set via Statement.setQueryTimeout() use a shared java.util.Timer instance
for scheduling. Even if the timeout doesn't expire before the query is processed, there
will be  memory used by the TimerTask for the given timeout which won't be reclaimed
until the time the timeout would have expired if it hadn't been cancelled by the driver.
High-load environments might want to consider disabling this functionality. (this
configuration property is part of the "maxPerformance" configuration bundle).

- - FixedBUG#27400- CALL /* ... */ some_proc() doesn't work. As a side effect of this
fix, you can now use /* */ and # comments when preparing statements using client-side
prepared statement emulation.
 
If the comments happen to contain parameter markers '?', they will be treated as belonging
to the comment (i.e. not recognized) rather than being a parameter of the statement.
 
Note that the statement when sent to the server will contain the comments as-is, they're
not stripped during the process of preparing the PreparedStatement or CallableStatement.
 
- - FixedBUG#25328- BIT(> 1) is returned as java.lang.String from
ResultSet.getObject() rather than byte[].
 
- - FixedBUG#25715- CallableStatements with OUT/INOUT parameters that are "binary"
(blobs, bits, (var)binary, java_object) have extra 7 bytes (which happens to be the
_binary introducer!)

- - Added configuration property "padCharsWithSpace" (defaults to "false"). If set to
"true", and a result set column has the CHAR type and the value does not fill the amount
of characters specified in the DDL for the column, the driver will pad the remaining
characters with space (for ANSI compliance).

- - Fixed issue where calling getGeneratedKeys() on a prepared statement after calling
execute() didn't always return the generated keys (executeUpdate() worked fine however).

- - Fixed issue where a failed-over connection would let an application call
setReadOnly(false), when that call should be ignored until the connection is reconnected
to a writable master unless "failoverReadOnly" had been set to "false".