File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes two servlets, one datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "two servlets, one datasource" Watch "two servlets, one datasource" New topic

two servlets, one datasource

Toby Davis
Ranch Hand

Joined: Apr 09, 2002
Posts: 65
I have a named JDBC datasource with pooling enabled that's maintained in my application server (i.e. JRun, WebSphere, etc).
Is it smart to have two different servlets using the same named datasource? Or is it better practice to have one datasource per servlet (even though each datasource ties into the same database)?
(If this is too simplified and more detail is needed, pls let me know)
[ May 21, 2002: Message edited by: Toby Davis ]

SCJP2 (1.4)
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

If u are going to use the same database with the same configuration values (e.g. user name,pool size etc) then go for the same datasource.

arun sahni
Ranch Hand

Joined: Jan 16, 2002
Posts: 91
I think connection pooling is better option.

Arun Sahni<br />SCJP2,SWCD,<br />BEA Certified Specialist: Server <br />JCert Enterprise Developer for BEA.
Kelly Harris

Joined: Mar 27, 2002
Posts: 22
Data Pooling is great the only caveat you have to pay attention to is the number of connections. Older versions of Access only allowed a small number of connections (like 20) at the same time. More recent versions of the drivers allow a more realistic amount.
subject: two servlets, one datasource
It's not a secret anymore!