"Craig R. McClanahan" wrote:

> Brian Burridge wrote:
>
> > Interesting that you brought of conneciton pools because that is
exactly what I'm
> > trying to do. We are using JSP for everything here, and I have a
database bean
> > with all my SQL in it. I decided a connection pool was necessary,
and downloaded
> > DBConnectionBroker from javaexchange.com (it's free.) The problem is
that it is
> > designed for servlets. The conneciton pool is local to each servlet,
and is
> > started in the init class, and destroyed in the destroy class. In
order for me to
> > use this, I have to have it in a scope outside a session or page. So
I am working
> > on the application scope. I am hoping that I can start a
connectionPool bean in
> > each JSP page with an application lifespan, and have a pool of
connections for
> > each app. It is a little mind boggling, plus I'm new to Java, and
I'm not even
> > sure if when I get this done, the theory is even going to work.
Plus, with this
> > strategy I will have to open the database connection in the jsp page
and then pass
> > it to my database bean, which is the opposite of my goal.
> >
>
> As you might have guessed, I did not just pull that example out of the
air :-).  I
> use application scope to store a connection pool object in exactly the
manner I
> described.

We used (jsp0.91) the extends directive to inheric all pages from a
generic 'application'
servlet. This servlet ties all jsp files for one application together.
The pool was
implemented as a static instance variable. The initialisation was done
in the init method
of this servlet.
However the only way in tying the dataaware beans to the connection pool
was by using a
little scriplet.

<BEAN name=db type="app.db.Employee">
</BEAN>
<%
Connection conn = pool.getConnection();
try {
   db.connect( conn );
%>
  :
<%
} finally {
   pool.freeConnection( conn );
}
%>

>
> Craig McClanahan

> --

Janco Tanis

------------------------------------------------------------
      COAS, Your partner in computer aided services

   Nijverheidsweg 34        Tel:   +31 (0) 187 49 3222
   Postbus 44               Fax:   +31 (0) 187 49 2912
   3250 AA Stellendam       Email: [EMAIL PROTECTED]

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to