You answered your own question -- multiple simultaneous queries requires multiple
simultaneous connections. So, you can create a new connection each time, or use a
connection pool. The first is inefficient because it is expensive to open and
close/kill connections to a database. The second is efficient because it maintains
open connections to the database.

Go to www.javaexchange.com for more info on this.

Boy, it's Connection Pool day here on the servlet-interest listserv!


Alvin Lau wrote:

> Thank you for your information about transaction.
>
> I used only one connection (put it in init()and use it in doPost()). I
> didn't test my code seriously ( it seem to be working well). It's not easy
> to debug. What do you mean by "multiple simultaneous connection"? also a
> question want to ask you, can a connection handle mutiple simultaneous
> query correctly? What will go wrong if I do it in my way?
>
> I'm not with my computer these two day. I think i will send my codes here,
> and may be you (or someone) can give me some +ve advice.
>
> alvin, lau
>
> On Thu, 25 Mar 1999, Scott Neufeld wrote:
>
> > Do you create a new connection each time a user tries to login? Or do you use
> > the same one each time? The first is extremely inefficient, and the second one
> > will not allow multiple simultaneous connections, and this is also extremely
> > inefficient.
> >
> > It is not just for transactions, it is for maintaining open database
> > connections that can be used as needed by one or more servlets (or helper
> > classes).
> >
> > Alvin Lau wrote:
> >
> > > I'm building a marketing's games, and I made a login's servlet a few weeks
> > > ago. What I did is that, when a user login in, first I check the user pw
> > > and id, and if I find a record in my db, then I create a new user's obj
> > > and put it in the session.
> > >
> > > I really don't understand why you need a connection pool. For me you need
> > > a connection pool only if you have to do transaction. Am i correct?
> > >
> > > If you want to see my codes, just let me know.. :-)
> > >
> > > alvin lau
> > >
> > > ___________________________________________________________________________
> > > 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

___________________________________________________________________________
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