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

how to keep connection pool instance in application  RSS feed

 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I want to use connection pool to connect with
the database,how to get a connection instance
in the whole application? in order to let
everyone can use get it. It seems means how
to keep the getConnection as a globel variable?

thanks
Krussi
 
Dharmesh Chheda
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello krussi

Connection pooling is not about keeping the connection object global or something.. why dont you use the application server connection pool.
Using this you can specify the maximum number of connections, their timrouts etc.
and the App server will do everything for you .. all you have to do in your code is to request a connection from the pool.
Which Application server are you using?..
 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Dharmesh,
I use Tomcat3.2.2 and WebSphere Application Sever
both for test. So how can I manage the database
connection in the application?
Thanks
Krussi
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!