Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 1897 invoked from network); 24 Oct 2008 15:06:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Oct 2008 15:06:36 -0000 Received: (qmail 54207 invoked by uid 500); 24 Oct 2008 15:06:39 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 53785 invoked by uid 500); 24 Oct 2008 15:06:38 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 53774 invoked by uid 99); 24 Oct 2008 15:06:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Oct 2008 08:06:38 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Oct 2008 15:05:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 525E1234C233 for ; Fri, 24 Oct 2008 08:05:44 -0700 (PDT) Message-ID: <2046070988.1224860744336.JavaMail.jira@brutus> Date: Fri, 24 Oct 2008 08:05:44 -0700 (PDT) From: "Oliver Matz (JIRA)" To: issues@commons.apache.org Subject: [jira] Created: (DBCP-276) DriverAdapterCPDS should allow to specify vendor specific properties MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 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.