Hi,
I've been looking through all of the documentation I can find, and I can't seem to find out whether what I'm doing is supposed to work or not...
I have a "Enterprise Application Client" that gets a UserTransaction and a DataSource (whose res-type is XADataSource).
@Resource(name = "jdbc/myDatasource")
private static DataSource someDataSource;
@Resource
static UserTransaction userTransaction;
This data source connects to an MS SQL Server 2005 database using the 1.2 JDBC drivers provided by MS with all the necessary stored procedures installed, and the MSDTC set to participate in XA transactions.
If my program exits in an unclean way then I am left with open transactions on the SQL Server database that will not go away. (I'm forced to use a somewhat buggy component that sometimes causes hard JVM crashes)
userTransaction.begin();
Connection connection = someDataSource.getConnection();
Statement statement = connection.createStatement();
statement.executeUpdate("UPDATE TestTable SET x=x+1 WHERE y=1");
if (true) {
System.exit(0);
}
// we never get here
userTransaction.commit();
I have set the transaction-manager to have a non-zero timeout (10), but still SQL Server never seems to become aware that the transaction should be aborted. The MSDTC transaction list shows the transaction as "Active" and seems to have the Glassfish TC as the "Parent" TC...
Any help would be appreciated...
Thanks,
--Chris
[Message sent by forum member 'christopherrued' (christopherrued)]
http://forums.java.net/jive/thread.jspa?messageID=347261