• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How to use connectionpooling for a datasource

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a datasource in WAS51 defined and I want to use the connection pooling. how do I have to write the code?

- get the inital context, the datasource and the connection each time required
- keep the context and get the datasource and the connction every time
- keep the datasource and get the connection everytime or
- keep the connection

what is the best way to do it? do I have to close the connection after each execution or is this managed by the server?

thanks
b
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What sort of application is this for? If its a web application, would you persist the context, datasource, or connection for multiple requests? The initial context is used for a lookup of the datasource. The datasource is a connection factory interface implemented by the vendor (IBM) to enable connection pooling, persisting that isn't useful either. And if you want to get a connection from the pool, why would you want to hang on to a connection? My understanding is very rudimentary, but I would suggest option 1 (feel free to correct me).
 
I am going to test your electrical conductivity with this tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!