----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
Hi!
the point of having the pool is that there is just one instance handling all
access to the db.
What you have to do is to have ONE servlet contain ALL of the connections and
then let the other servlets borrow the connections from there. (And also have
them return the connections
when they are done accessing the db.) You need some methods in the connection
servlet that handles
the handing out and returning of the connections and these methods can be
accessed by the other servlets
by using
"getServletConfig().getServletContext().getServlet("myconnservlet");" to
retrieve the servlet object.
So make sure that only one servlet(autostarted by jserv) creates a pool and
do not create pools
in all servlets since you can access the connections in the "jdbcservlet" by
using its methods(after you have obtained
the servlet object).
My experience is that pooling not only speed things up but sis neccessary to
avoid problems
when you have multiple servlets with threads trying to use the db.
HTH
//OLAS
David Molloy skrev:
> ----------------------------------------------------------------
> BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> WHEN YOU POST, include all relevant version numbers, log files,
> and configuration files. Don't make us guess your problem!!!
> ----------------------------------------------------------------
>
> Hi,
> I'm using Solaris, Apache and JServ connecting to an Oracle
> database using OCI drivers and I got everything working across JDBC.
> The next step naturally is to improve the speed by implementing
> some sort of Connection pool. I'm in the process of
> doing that at the minute but I have a problem. I have taken a connection
> pool from a 3rd party (freeware) and my servlet on init() builds the
> connection pool. Then when the servlet is called later it uses the
> connections fine each time. However if I make a second (different)
> servlet I create another connection pool, with it's own connections.
>
> Rapidly I'm seeing my number of connections getting very large the
> more different servlets I have.
>
> So essentially my question is: what is the best way to use
> connection pools and servlets? I'm managing a relatively low
> usage site (a large intranet and then some external accesses
> which will use database connections) but I'm pretty sure I'm
> not just meant to have 50 different connection pools for my
> 50 differnt servlets etc. Should I be using some sort of
> session passing? I won't have a connection to give everyone
> on the site - so is there another way?
>
> Thanks in advance for any help anyone might have.
>
> David Molloy
> Dublin City University, Ireland.
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Archives and Other: <http://java.apache.org/main/mail.html>
> Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]