Affects Version/s: None
Fix Version/s: 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:
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.