"Kwan, Kenneth Y" wrote:
> So, does anyone know that Oracle 8i JDBC OCI driver can support concurrent
> statements on the same connection, e.g. connection which is shared by many
> servlets ?
>
There are really two issues here.
Yes, the Oracle drivers support multiple active statements per connection. The
connection can be shared by many servlets -- a very convenient way is to store
the open connection as a servlet context attribute
(ServletContext.setAttribute()).
However, you need to consider what happens when more than one person is using
your servlet-based application. If they are all using the same connection, the
fact that you have multiple statements works fine, up until the point where you
do a COMMIT or ROLLBACK for a user. At that point, the database transaction
which is running is completed -- and this affects *all* of the users, whether
they are through or not! Database transactions are global to a connection.
This is one of the reasons that connection pools were created. The idea is
that, within a single response, you follow this kind of a design pattern:
* Allocate a connection from the pool
* Do all the database work you need
* Do a COMMIT or ROLLBACK
* Return the connection to the pool
In this way, the database accesses from different simultaneous users do not
interfere with each other, because they are running in different transactions.
Within a particular transaction, you can still have multiple statements open if
you need them (because Oracle supports this), but they will all be aimed at
performing part of a single overall process.
There have been tons of discussions about connection pools on this list, along
with sources for several versions of them. See the list archives
(http://archives.java.sun.com) for details, or check some of the FAQ sites.
>
> Kenneth
>
Craig McClanahan
___________________________________________________________________________
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