Hi,

I'am starting with DBCP and Tomcat because of some pooling
problems with Tyrex and Poolman.
First of all, It seems like DBCP works very well.

Now, I've got just a little problem with getConnection method
and credentials : PoolingDataSource object doesn't support
getConnection(user, password) method and throw
an "UnsupportedOperationException".

I understand it as a pooled connections can't be shared among
multiple database users. My problem is that some application
still use getConnection(user, password) method even with
DataSource, so using DBCP with those applications is impossible
without modifing app. code.

So, here is my proposal : Why not modifing getConection(user,
password) in BasicDataSource so that :
- if username/password are good ones, this method forward
toward getConnection()
- if not, this method throw a SQLExeption, saying something
like "Invalid username/password"

I've tried to modify source code and I ask you if it would be
correct to transform getConnection(username, password) in
BasicDataSource like this :

-----------------------------------------------------------
public Connection getConnection(String username, String
password)
  throws SQLException {

  if(username.equalsIgnoreCase(this.username) &&
password.equalsIgnoreCase(this.password)) {
    return (createDataSource().getConnection());
  } else {
    throw new SQLException("DBCP : Invalid username/password");
  }
}
-----------------------------------------------------------

Thanks in advance for your responses


Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,13 
€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)"




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

Reply via email to