MySQL Connector/J 2.0.14 XA bugs

MySQL Connector/J 2.0.14 XA bugs

am 19.03.2003 17:19:38 von juergen.hoeller

Hi 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

Re: MySQL Connector/J 2.0.14 XA bugs

am 19.03.2003 18:00:37 von Mark Matthews

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jürgen höller [werk3AT] wrote:
> Hi 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=true - 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!

I will look at including these patches.

> 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?
>

The code was removed for two reasons...First, the XA code (which is
actually from Tyrex...they have an XAWrapper that you could use, which
is where this code originated, have you investigated using that?) had a
license that was not compatible with the license change to GPL Second,
MySQL _does_not_currently_support_ XA, so this code can actually lead to
heuristic failures that _will_ corrupt your database!

XA support is on the drawing boards, but no defintive time to implement
it has been decided, as there has not been a lot of call for it. If you
need XA from MySQL, you should be asking for it from MySQL in the
mailing lists, or by becoming a paying customer (if you aren't alread
one)...You are only the 4th or 5th user that has ever asked out loud for
it, so it currently is not planned to come before subselects, views,
triggers and stored procedures which are features that are asked for
thousands of times :(


-Mark
- --
MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+eKI7tvXNTca6JD8RAoPCAJsGhlo7ptQnQzsrOAyozUp1s4tN0wCf YKKm
tl0okRVdjO8lVfsTBQ83eIg=
=FiV3
-----END PGP SIGNATURE-----


------------------------------------------------------------ ---------
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-thread13994@lists.mysql.com
To unsubscribe, e-mail