wood burning stoves 2.0*
The moose likes JDBC and the fly likes Connection Pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Pooling" Watch "Connection Pooling" New topic
Author

Connection Pooling

Josh_Batchelor
Greenhorn

Joined: Dec 17, 2001
Posts: 1
I am using a Connection Pool that I instantiate with <jsp:useBean id="email" scope="application" class="connectionpool.ConnectionPool" />. My question is how would I use this from another servlet?
[ Edited by Dave to fix the < ]
[This message has been edited by David O'Meara (edited December 17, 2001).]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Josh_Batchelor",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.
Dave
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
Someone please correct me if I'm wrong, but isn't connection pooling managed not by the programmer but by the container?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
It depends on the container/server. I know websphere already has a connection pool manager. But say you are using Tomcat, then you have to code and manage your own connection pooling.
------------------
Bosun
SCJP for the Java� 2 Platform


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
C Balajee
Greenhorn

Joined: Oct 18, 2000
Posts: 25
Hi Bosun,
I also aggree that closing the conection will in turn close the statement and the resultset.
By "closing" you must mean that that the particular statement/resultset is not available for further use..
My query is what will happen if a reference to the closed resultset still exists in the memory..??
Will the connection pool manager of WebSphere release the connection for further use??
regards
C Balajee
C Balajee
Greenhorn

Joined: Oct 18, 2000
Posts: 25
sorry Guys,
I posted the wrong reply in the wrong thread...
regards
C Balajee
C Balajee
Greenhorn

Joined: Oct 18, 2000
Posts: 25
This is my correct post..
You can try the following code in other JSP's or servlets..
session.getAttribute("email");
this will return an object which you need to cast to your connection pool.
the variable "session" is readily available with JSP Pages..
But in servlet you need to call
requestObject.getSession(true/false)
Hope this helps...
regards
C Balajee
sorry for the inconvinience..
Josh Batchelor
Greenhorn

Joined: Dec 18, 2001
Posts: 9
Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Connection Pooling