commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject Re: DBCP: how to reset pool if I change user/password credential in the database?
Date Thu, 27 May 2004 13:06:38 GMT

Hi Claudio,

the reason for resorting to an object pool is for saving time and effort
in the creation phase of any object, so you can recycle an instance
without destroying, garbage-collecting and re-creating.

In db terms saving is worth the effort if all the Connection(s)
are the same, and you can grab one of the pool just when 
you need it.

If the apps requires a lot of different users, you have to 
think about a lot of different (perhaps empty) pools, so vanifying
the effort: perhaps asking for a java.sql.Connection any time
you need it may be a more efficient choice.

Anyway the db behaviour when password is changed or user
is disabled is system dependent: for instance in Oracle
you keep the connections open, but you won't be able to create
a new one.

In your case you might add a validation query in the
  *.jocl configuration file:

   <string value="SELECT COUNT(*) FROM EMP"/> <!-- validation query -->
  and turn on the 'test on borrow' / 'test on return' flags
  so when the dbserver closes the connection DBCP will evict the
  pending pool connections.

Hope may help

Scrive Claudio Masini <>:

> I'm using DBCP to connect to DB2 on S/390.
> For security reason each user must connect to DB with his own user/password
> so I use ds.getConnection(user, password) method to get a connection.
> The DB2 uses RACF for password management and it's configured to expire
> password after 30days.
> If user try to connect with new password the pool throw an Exception because
> the password used to connect is different from the original one used to
> create his entry in the pool.
> Questions:
> - is there a way to reset user?
> - is there a timeout after that a user/password entry are removed from the
> pool and so resetted?
> Thanks for any help
> Claudio
> ----------------------------------
> Ing. Claudio Masini
> Quix S.r.l.
> Strada Statale Romana 413 n. 160
> (Nazionale per Carpi)
> 41019 Appalto di Soliera (MO)
> tel 059.565388
> fax 059.565322
> email:
> ---------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message