See my comments below...

On Tue, 2 Oct 2001 11:30:11 -0700 (PDT)
 "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote:
> 
> 
> On Tue, 2 Oct 2001, Will Stranathan wrote:
> 
> > respond to it, but Remy noted that Catalina doesn't
> rebind
> > resolved objects in the JNDI implementation.
> >
> 
> I don't think you want to rebind *every* object
> universally - sometimes
> the factory really is a factory.

Agreed.

> > in the init() of every servlet returns a different
> > DataSource from every other servlet.  So a connection
> pool
> > is only valid for that particular servlet.
> >
> 
> The typical usage of lookup() in J2EE apps has you doing
> the lookup on
> every single need for a connection, and not keeping the
> connection:
> 
>   DataSource ds = (DataSource)
>     ctx.lookup("java:comp/env/jdbc/Foo");
>   Connection conn = ds.getConnection();
>   ... use the connection ...
>   conn.close();   // Returns connection to the pool

As per previous messages, though, since the DataSource isn't
rebound, you get a different DataSource object every time.

> 
> The existing factory for Tyrex *always* creates a new
> data source
> implementation when you call lookup().
> 

The workaround recommended was to get one DataSource in the
init() method of the servlet.  When doing this, there is, of
course, only the single DataSource instance.  However, every
time getConnection() is called against it, it creates a
brand new physical connection - then close() does not
actually close the physical connection - I assume to return
it to the pool, but it is never re-used - every single call
to getConnection() returns a new connection.

> > Thanks,
> > Will Stranathan
> >
> 
> Craig
> 
> 

Reply via email to