You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Phil Steitz (JIRA)" <ji...@apache.org> on 2009/01/25 05:15:59 UTC

[jira] Updated: (DBCP-276) DriverAdapterCPDS should allow to specify vendor specific properties

     [ https://issues.apache.org/jira/browse/DBCP-276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated DBCP-276:
-----------------------------

    Fix Version/s: 1.3

> DriverAdapterCPDS should allow to specify vendor specific properties
> --------------------------------------------------------------------
>
>                 Key: DBCP-276
>                 URL: https://issues.apache.org/jira/browse/DBCP-276
>             Project: Commons Dbcp
>          Issue Type: Improvement
>            Reporter: Oliver Matz
>             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.