You only use one user ID and password when creating a ConnectionPool. You don't
create a pool for each user that signs in. You would use multiple pools if, for
example, you want to connect to multiple databases. Then you need a Connection
Pool manager. Again, check out www.javaexchange.com for more info on this.


Sam Rose wrote:

> Sorry I forgot to add that I use this,
>
> try {
> if (pool == null) {
>                 try {
>                         pool = new ConnectionPool(db_address, user, passwd,
> "oracle.jdbc.driver.OracleDriver", 2,1);
>                 }
>                 catch (Exception e) {
>                         throw new UnavailableException(this, "Couldn't create
> ConnectionPool");
>                 }
> }
> //gets connection
>         con = pool.getConnection();
>
> Is this what you mean, or am I still misusing the connection pool.
>
> I have read Hunters book, and try his idea of using the connection
> pool in the init. method, but as I have different users logging in, I
> am unable to get their user ID and password, as the variables have not
> yet been initialised.
>
> Any ideas or suggestions?
>
> -----Original Message-----
> From:   Thomas Moore [SMTP:[EMAIL PROTECTED]]
> Sent:   Thursday, March 25, 1999 1:22 PM
> To:     [EMAIL PROTECTED]
> Subject:        Re: Can anyone explain this to me.
>
> > Database connection pools.
> >
> > If I have the code in each of my servlets, i.e. the code that calls
> > the connection pool servlet and this code.
> >
> > pool = new ConnectionPool(dba, user, passwd,
> > "oracle.jdbc.driver.OracleDriver", 2,1);
> >
> > Is this not the same as making a new connection with each servlet.
> >
> > How does this improve my connection timing?
>         Ummm... It doesn't, but that's because you're mis-applying
> the
> pattern.  The idea is to have N Connections in the ConnectionPool,
> and
> then call dbConn = pool.getConnection();  The pool object keeps an
> internal counter, and keeps track of how many of its connections are
> in
> use.  The pool should generally be implemented as a singleton.
>         I'd recommend reading Grand's book "Patterns in Java", if you
> haven't
> yet...
>
> --
> Within C++ is a smaller, cleaner language
> struggling to get out.
> It's called Java.
>
> Thomas Moore
> [EMAIL PROTECTED]        Home Account
> Software.Engineer         [EMAIL PROTECTED]
> phone://732.462.1880:268  NJ Patterns Group Home Page
> employer://Celwave, RF    http://members.home.net/twmoore/cjpg
>
> _______________________________________________________________________
> ____
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to