DB connection between Two servlets

Hi,

I have Two servlets, servlet1,servlet2.

In servlet1, I have written Connection Pooling using java class and In the INIT method I'm writing the database connection,

My Question is, How to use the same DB connection in servlet2 ?

here is my code (some portion) :

public class abc_internal extends HttpServlet

{ private ConnectionPool pool;

Statement stmt= null;

Statement stmt1= null;

Statement stmt2= null;

ResultSet abc = null;

ResultSet Name_Header= null;

private static final String CONTENT_TYPE = "text/html; charset=windows-1252";

public void init(ServletConfig config) throws ServletException

{

try

{

pool = new ConnectionPool("oracle.jdbc.driver.OracleDriver","jdbc:oracle:thin:@IPADDRESS:1526:DB NAME","USERNAME","PASSWORD",5);

}catch(Exception e)

{

throw new UnavailableException("Couldn't create Connection Pool.....");

}

}

PLEASE Help me...

Thanks in advance.

[1036 byte] By [steve_martina] at [2007-11-27 2:39:49]
# 1
Refractor it to another non-public class in the same package and make the ConnectionPool static.
BalusCa at 2007-7-12 3:02:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks for the reply... I'm new to Java...I would appreciate, if you can show me as a example for the above code...Thanks.
steve_martina at 2007-7-12 3:02:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...