Chuck is right in that it can't be done with the standard pool that Tomcat has. Due simply to the fact that the pool is established before anyone has made a call to the server.

But what you could do is to create a connection for that user when they authenticate and hold on to the connection for the session. Two limitations are the time on the connection and the potential number of open connections. If you control the time the connection is held alive for the session and return it after some period of time to prevent time out on the database side or tying up a connector forever. In essence you will be creating a one connection pool for each session. Second is the total number of connections. How many users are there going to be on the system at once and can the system handle that many open connections?

If you come up with a different/better solution let us know.

Doug


----- Original Message ----- From: "Caldarale, Charles R" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Sunday, October 09, 2005 11:26 PM
Subject: RE: using a datasource connection pool resource with username and password supplied by user


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Subject: using a datasource connection pool resource with
username and password supplied by user

But what I really want to do is to get a database user and
password from the user and (after validating it) write this
to a session cookie.  Then when the user interacts with the
database (which is all the time) the username and password
will be extracted from the cookie and used in the following
way:

I don't think you can do this with a connection pool.  The connections
in the pool are opened once only, and persist for the life of the
application, not the session.  Any user (session) can end up using any
of the connections, which is why you have to configure the credentials
with the ressource.  I think if you want to authenticate on each
session, you'll have to dispense with the pool and suffer the overhead
of opening a DB connection each time.

Perhaps someone else has a better idea...

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to