aspose file tools*
The moose likes JDBC and the fly likes Connection Pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Pooling" Watch "Connection Pooling" New topic
Author

Connection Pooling

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
I have a query regarding connection pooling. Am using a data source for the EJB interface. And it uses 50 connections minimum. While the running it reuses the connection (as per pooling technique) but in every transaction some data’s were updated on the database. How come the new data will reflect on the interface application with old connection object.

Whether we need to refresh the database everytime before the transaction starts
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30957
    
158

Meet,
When you close the connection, it commits (updates the database) and returns to the pool for another transaction. There isn't overlap between multiple requests. Everytime you request a connection from the pool, you start out clean.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492

So by default when I close the connection it commits the database. No need to call commit from java side
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



Its uncharacteristic behaviour of the Driver which we cannot rely on. However I find Its true that it commits any un-rollbacked transactions when you close the connection.
 
Don't get me started about those stupid light bulbs.
 
subject: Connection Pooling