Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we preserve Connection object using any of the desin pattern such as service loca  RSS feed

 
Sudheesh
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sirs,

Can we preserve Connection object using any of the desin pattern such as service locator?
Will the container close the connection itself after some idle time? If that is the case, how can we preserve the connection?
I heard that to obtain a connection every time, is additional overhead to the container..

Thank you,
Sudheesh K S
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sudheesh,

At least in theory this is not necessary. You always get a connection from the pool and release it as soon as possible. This should not take any time though and should be the most optimal approach. Moreover some containers will retain the connection for the duration of the entire transaction. Hence it would be no overhead whatsoever.
In practice though, things might look little bit different. We had some similar discussions about this subject on this forum and you might check this thread:

http://www.coderanch.com/t/316606/EJB-JEE/java/Passing-connection-object-as-arguement

Regards.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!