tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Stranathan <w...@thestranathans.com>
Subject Re: Tyrex Pools
Date Tue, 02 Oct 2001 03:42:44 GMT
Ah - that makes sense.  However, it seems to still be doing the same 
thing.  I just threw together a simple JSP to test it, and put the ds 
lookup in jspInit().  The lookup is only getting executed once, but it 
still looks like no connections are getting re-used.

Anything else for me to look at?

Will Stranathan

<%!
     DataSource ds = null;
     public void jspInit() {
         try {
             Context ctx = new InitialContext();
             ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Directory");
             System.out.println("did lookup");
         } catch (Exception e) {
             e.printStackTrace();
         }
     }
%>


<%
     Connection conn = null;
     if (ds != null) {
         try {
             conn = ds.getConnection();

etc....



Remy Maucherat wrote:

> Instead, I would retrieve the DataSource in the init() method of the
> servlet, and put it in an instance variable.
> 
> Remy
> 
> 



Mime
View raw message