jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes Setting connection Attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Setting connection Attribute" Watch "Setting connection Attribute" New topic
Author

Setting connection Attribute

Jotty Tharakan
Greenhorn

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.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
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: http://aspose.com/file-tools
 
subject: Setting connection Attribute