Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

encountering WorkRolledbackException 1

Status
Not open for further replies.

dushy

Programmer
Sep 26, 2002
1
US
Hi,
I am using websphere 4.0 when i get a connection from the DataSource and do a SELECT statement, when i close the connection it throws an exception

"WorkRolledbackException: Outstanding work on this connection was not committed or rolled back by the user and has been rolledback."

I did not change anything... i just selected a few rows.. select * from mytable (i read somewhere on the net that i can rollback everytime to avoid this exception)

I dont want to rollback everytime i use the db.. i am not getting this problem if i use DriverManager.getConnection() but i want to use DataSources.. any help....

Thanks,
Dushy
 
According to IBM, WebSphere will throw this exception if setAutoCommit(false) was set on the connection and there was no explicit commit/rollback prior to the connection being closed.

You have three options:
1. Don't use setAutoCommit(false) -- at least not on selects
2. Explicitly call commit or rollback prior to closing the connection
3. Wrap your close statement in a try/catch and do nothing in the catch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top