commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Matz (JIRA)" <>
Subject [jira] Commented: (DBCP-276) DriverAdapterCPDS should allow to specify vendor specific properties
Date Mon, 15 Feb 2010 02:43:36 GMT


Oliver Matz commented on DBCP-276:

Ich bin bis einschlie├člich Fr, den  12.02.2010 au├čer Haus.

I am out of the office up to and including Fr Feb 12th, 2010.

  Oliver Matz

> DriverAdapterCPDS should allow to specify vendor specific properties
> --------------------------------------------------------------------
>                 Key: DBCP-276
>                 URL:
>             Project: Commons Dbcp
>          Issue Type: Improvement
>            Reporter: Oliver Matz
>            Assignee: Phil Steitz
>             Fix For: 1.3
> Currently, the class DriverAdapterCPDS creates instances of the package-visible class
PooledConnectionImpl by passing a java.sql.Connection created via method 
> DriverManager.getConnection(String url, String user, String password).  
> However, there is a more general methods that could reasonably replace this, namely:
> DriverManager.getConnection(String url, java.util.Properties info). 
> One reason to prefer this one is to specify vendor specific properties, in our case CHARSET_CONVERTER_CLASS
for the sybase jdbc driver.
> There are three ways out, ordered by increasing convenience:
> (1) Make class PooledConnectionImpl and its constructor public, then we can subclass
DriverAdapterCPDS  and override method getPooledConnection(String username, String password)
to instantiate PooledConnectionImpl  with a differently created java.sql.Connection.
> (2) In DriverAdapterCPDS, factor out the statement 
>         DriverManager.getConnection(getUrl(), username, password),
> into a protected, non-final method, say   createConnection(String username, String password).
> Then we can subclass DriverAdapterCPDS and override this method appropriately.
> (3) Add a member variable DriverAdapterCPDS.mConnectionProps and a method such as DriverAdapterCPDS.setProperties(Properties
props) that adds all properties to mConnectionProps.  In DriverAdapterCPDS, instead of invoking
DriverManager.getConnection(getUrl(), username, password), do:
>    mConnectionProps.put("user", username);
>    mConnectionProps.put("password", password);
>    DriverManager.getConnection(getUrl(), mConnectionProps);
>    By the definition of DriverManager.getConnection(String url, String user, String password),
this should be equivalent at least in case both username and password are set.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message