Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection Pooling

 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34681
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So by default when I close the connection it commits the database. No need to call commit from java side
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic