It's not a secret anymore!
The moose likes Servlets and the fly likes Constant JDBC Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Constant JDBC Connection" Watch "Constant JDBC Connection" New topic

Constant JDBC Connection

Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
On my webpage visitors will frequently make database querys. Is it possible to run a connection in the background that all servlets will be able to tap into? Like a constantly logged in helper that is available to all servlets? How would I do this?

Thanks for atleast reading things,
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63534

Your best bet in such an environment is container-managed connection pooling.

[Asking smart questions] [About Bear] [Books by Bear]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

An old thread that discusses this in length just resurfaced today.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Constant JDBC Connection
jQuery in Action, 3rd edition