File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Setting connection Attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Setting connection Attribute" Watch "Setting connection Attribute" New topic

Setting connection Attribute

Jotty Tharakan

Joined: Dec 14, 2001
Posts: 17
We are taking conection from IAS connection pool for our work.My doubt is this.
If Bean A takes a connection from pool and set the attribute of the connectio object to
con.setAutocommit(false).After commit he is returning the conection to pool.
Now suppose Bean B gets the same connection from the pool and he is expecting the default attribute from the connection object.So he is not committing explicitly.
I suspect that since bean A sets the attribute to Autocommit(false) the updation done by bean B will not be committed unless bean B explicitly commit it.
Can anyone comment on this .Is my conclusion correct or not ?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
The connection should return to it's default state once it has been returned to the pool.

So much trouble in the world -- Bob Marley
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 567
If you do this for a test you can find out:
- configure the pool for a certain number of connections
- get that many connections from the pool all at once
- set autocommit on them all
- close them/release them all
- get another connection, which you will know you definitely set autocommit on
- call getAutoCommit()

[ June 16, 2002: Message edited by: Adam Hardy ]

I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
I agree. Here's the link:
subject: Setting connection Attribute
jQuery in Action, 3rd edition