MySQL Connector/J 2.0.14 XA bugs
am 19.03.2003 17:19:38 von juergen.hoellerHi MySQL team,
I've fixed 2 bugs in MySQL Connector/J 2.0.14's XA support:
1.
MysqlXaDataSource needs to override "getXAConnection()" (and accordingly =
"getPooledConnection()") to use the _User and _Password properties. =
Else, user/password configuration via properties does not work. For =
example, this causes Tyrex 1.0 to fail because it tries to connect to =
the database with empty user and password. Note that other resource =
managers like Resin 2.1 work because they use the overloaded =
"getXAConnection(user,password)" version with user/password settings =
managed by themselves.
2.
XAConnectionImpl tries to initialize connections by committing them. But =
datasource access outside of a transaction results in connections that =
are autocommit=3Dtrue - which causes a commit call to throw an =
exception. Therefore, XAConnectionImpl needs to check the autocommit =
status before trying to commit for initialization. An aside: Is such =
initialization committing proper behavior? Shouldn't this rather be =
initialization fallback, if at all?
I am aware that Connector/J's 3.x branch is the main one now. But we at =
werk3AT (and I guess a lot of other people) still use MySQL 3.23.x and =
MySQL Connector/J 2.0.x and cannot switch easily, especially not in =
production systems. So I urge you to include these fixes at your =
earliest convenience!
Finally, I've just noticed that switching to Connector/J 3.x. would not =
help - 3.0.6 does not include XA support anymore! Why has it been =
removed?
Many thanks in advance!
Regards,
Juergen
How-To-Repeat:
1.
Configure any MySQL instance with Tyrex 1.0 (assumably inside Tomcat =
4.1) and access it, or try to manually setup a MysqlXaDataSource for a =
MySQL instance and access it with the user/password properties and a =
"getXAConnection()" call.
2.
Try to configure any MySQL instance as XA-capable resource in any =
resource manager and access it outside of a JTA transaction.
MysqlXaDataSource.java snippet:
/**
* Creates a new connection using the already configured
* username and password.
* NEW: needed for proper usage, e.g. with Tyrex.
*/
public PooledConnection getPooledConnection() throws SQLException {
return getPooledConnection(_User, _Password);
}
/**
* Creates a new connection using the already configured
* username and password.
* NEW: needed for proper usage, e.g. with Tyrex.
*/
public XAConnection getXAConnection() throws SQLException {
return getXAConnection(_User, _Password);
}
XAConnectionImpl.java snippet (similar code occurs 3 times in this =
file):
// The underlying connection is closed and this connection
// is no longer useable. This method can be called any number
// of times (e.g. we use it in finalizer). We do not handle
// transactions, we just kill the connection.
// NEW: only try to commit in case of non-autocommit connection
try {
if ( _underlying !=3D null && !_underlying.getAutoCommit() ) {
_underlying.commit();
_underlying.close();
}
=20
DI Jürgen Höller
Senior System Architect
__________________________________
werk3ATS - division systementwicklung
part of werk3AT internetmedien oeg
europaplatz 4
A - 4020 linz
t. +43 (0) 732 71 65 29
f. +43 (0) 732 71 65 29 3
juergen.hoeller@werk3at.com
www.werk3at.com
__________________________________
werk3ATS - WIR ENTWICKELN ERFOLG
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread13993@lists.mysql.com
To unsubscribe, e-mail