I have a no-tx-datasource in JBOSS 4.0.4 and I do the following:
DataSource datasource = (DataSource) context.lookup("noTxDatasource")
Connection connection = null;
try{
datasource.getConnection();
connection.setAutoCommit(false)
//do some stuff with connection
connection.commit();
}
finally{
if(connection != null){
try{
connection.setAutoCommit(true);
connection.close()
}
catch(SqlException e){
//log warning
}
}
}
The reason I'm calling the setAutoCommit(true) in the connection just before
closing (or returning it to the pool) is that the Inet driver that I'm using
seems to be opening a transaction after closing the connection (if autocommit
is set to false). I inferred this because I debugged through the code and
obtained a connection from DriverManager and inspected the autocommit flag and
the open transactions in the database and after commit there is indeed a new
transaction, but as soon as I have set AutoCommit back to true is closes the
transaction.
But my problem is doing this through JBOSS doesn't seem to work. I tried to set
the AutoCommit back to true but looking at the database is still seems to
appear the calling setAutoCommit(true) doesn't do anything because I still have
an open transaction in the database.
Can anyone help?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976204#3976204
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976204
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user