Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 73367 invoked from network); 20 Jul 2010 10:50:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Jul 2010 10:50:36 -0000 Received: (qmail 22856 invoked by uid 500); 20 Jul 2010 10:50:36 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 22785 invoked by uid 500); 20 Jul 2010 10:50:34 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 22751 invoked by uid 99); 20 Jul 2010 10:50:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jul 2010 10:50:32 +0000 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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jul 2010 10:50:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9B3072388900; Tue, 20 Jul 2010 10:49:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r965793 - in /db/derby/code/trunk/java: client/org/apache/derby/jdbc/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ Date: Tue, 20 Jul 2010 10:49:35 -0000 To: derby-commits@db.apache.org From: kristwaa@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100720104935.9B3072388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kristwaa Date: Tue Jul 20 10:49:35 2010 New Revision: 965793 URL: http://svn.apache.org/viewvc?rev=965793&view=rev Log: DERBY-4067: ClientConnectionPoolDataSource.getPooledConnection and ClientXADataSource.getXAConnection ignore connection attributes DERBY-2468: would be nice if traceFile=filename connection attribute would be supported with ClientConnectionPoolDataSource and ClientXADataSource Made two changes: - moved the parsing of the connection attribute string to before the log writer is constructed, since the construction may depend on some attributes specified in the connection attribute string - added parsing of the connection attribute string to the client ConnectionPool and XA data sources Also re-enabled 'testClientMessageTextConnectionAttribute' and removed a work-around for the issue fixed by this commit. Patch file: derby-4067-1a-update_attrs.diff Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java?rev=965793&r1=965792&r2=965793&view=diff ============================================================================== --- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java (original) +++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConnectionPoolDataSource.java Tue Jul 20 10:49:35 2010 @@ -74,6 +74,8 @@ public class ClientConnectionPoolDataSou LogWriter dncLogWriter = null; try { + updateDataSourceValues( + tokenizeAttributes(getConnectionAttributes(), null)); dncLogWriter = super.computeDncLogWriterForNewConnection("_cpds"); if (dncLogWriter != null) { dncLogWriter.traceEntry(this, "getPooledConnection"); @@ -98,6 +100,8 @@ public class ClientConnectionPoolDataSou LogWriter dncLogWriter = null; try { + updateDataSourceValues( + tokenizeAttributes(getConnectionAttributes(), null)); dncLogWriter = super.computeDncLogWriterForNewConnection("_cpds"); if (dncLogWriter != null) { dncLogWriter.traceEntry(this, "getPooledConnection", user, ""); Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java?rev=965793&r1=965792&r2=965793&view=diff ============================================================================== --- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java (original) +++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java Tue Jul 20 10:49:35 2010 @@ -25,12 +25,9 @@ import java.sql.Connection; import java.sql.SQLException; import javax.sql.DataSource; -import org.apache.derby.client.am.ClientMessageId; import org.apache.derby.client.am.LogWriter; import org.apache.derby.client.am.SqlException; -import org.apache.derby.client.net.NetConnection; import org.apache.derby.client.net.NetLogWriter; -import org.apache.derby.shared.common.error.ExceptionUtil; /** * ClientDataSource is a simple data source implementation @@ -162,7 +159,18 @@ public class ClientDataSource extends Cl * @throws java.sql.SQLException if a database-access error occurs. */ public Connection getConnection() throws SQLException { - return getConnection(getUser(), getPassword()); + LogWriter dncLogWriter = null; + try { + updateDataSourceValues( + tokenizeAttributes(getConnectionAttributes(), null)); + dncLogWriter = super.computeDncLogWriterForNewConnection("_sds"); + return getConnectionX(dncLogWriter, getUser(), getPassword()); + } catch (SqlException se) { + // The method below may throw an exception. + handleConnectionException(dncLogWriter, se); + // If the exception wasn't handled so far, re-throw it. + throw se.getSQLException(); + } } /** @@ -184,11 +192,10 @@ public class ClientDataSource extends Cl LogWriter dncLogWriter = null; try { + updateDataSourceValues( + tokenizeAttributes(getConnectionAttributes(), null)); dncLogWriter = super.computeDncLogWriterForNewConnection("_sds"); - updateDataSourceValues(tokenizeAttributes(getConnectionAttributes(), null)); - return ClientDriver.getFactory().newNetConnection - ((NetLogWriter) dncLogWriter, user, - password, this, -1, false); + return getConnectionX(dncLogWriter, user, password); } catch(SqlException se) { @@ -200,5 +207,12 @@ public class ClientDataSource extends Cl } + private Connection getConnectionX(LogWriter dncLogWriter, + String user, String password) + throws SqlException { + return ClientDriver.getFactory().newNetConnection( + (NetLogWriter)dncLogWriter, user, password, this, -1, false); + + } } Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java?rev=965793&r1=965792&r2=965793&view=diff ============================================================================== --- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java (original) +++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADataSource.java Tue Jul 20 10:49:35 2010 @@ -22,11 +22,9 @@ package org.apache.derby.jdbc; import java.sql.SQLException; -import javax.sql.DataSource; import javax.sql.XAConnection; import javax.sql.XADataSource; -import org.apache.derby.client.ClientXAConnection; import org.apache.derby.client.net.NetLogWriter; import org.apache.derby.client.am.LogWriter; import org.apache.derby.client.am.SqlException; @@ -62,13 +60,28 @@ public class ClientXADataSource extends } public XAConnection getXAConnection() throws SQLException { - return getXAConnection(getUser(), getPassword()); + NetLogWriter dncLogWriter = null; + try { + updateDataSourceValues( + tokenizeAttributes(getConnectionAttributes(), null)); + dncLogWriter = (NetLogWriter) + super.computeDncLogWriterForNewConnection("_xads"); + return getXAConnectionX( + dncLogWriter, this, getUser(), getPassword()); + } catch (SqlException se) { + // The method below may throw an exception. + handleConnectionException(dncLogWriter, se); + // If the exception wasn't handled so far, re-throw it. + throw se.getSQLException(); + } } public XAConnection getXAConnection(String user, String password) throws SQLException { NetLogWriter dncLogWriter = null; try { + updateDataSourceValues( + tokenizeAttributes(getConnectionAttributes(), null)); dncLogWriter = (NetLogWriter) super.computeDncLogWriterForNewConnection("_xads"); return getXAConnectionX(dncLogWriter, this, user, password); Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java?rev=965793&r1=965792&r2=965793&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java Tue Jul 20 10:49:35 2010 @@ -176,9 +176,8 @@ public class J2EEDataSourceTest extends suite.addTest(new J2EEDataSourceTest("testClientDSConnectionAttributes")); suite.addTest(new J2EEDataSourceTest( "testClientTraceFileDSConnectionAttribute")); - //DISABLED until DERBY-4067 is fixed. - //suite.addTest(new J2EEDataSourceTest( - // "testClientMessageTextConnectionAttribute")); + suite.addTest(new J2EEDataSourceTest( + "testClientMessageTextConnectionAttribute")); suite.addTest(new J2EEDataSourceTest("testConnectionFlowCommit")); suite.addTest(new J2EEDataSourceTest("testConnectionFlowCommitAlt")); // Disabled because rollback flow optimization hasn't been implemented. @@ -2889,14 +2888,8 @@ public class J2EEDataSourceTest extends public Object run() { for (int i=3 ; i <= 6 ; i++) { File traceFile = new File("trace" + i + ".out"); - // Skip trace 3 and 5 until DERBY-2468/DERBY-4067 is fixed. - if (i == 3 || i == 5) - continue; - else - { - assertTrue("Doesn't exist", traceFile.exists()); - assertTrue("Delete failed", traceFile.delete()); - } + assertTrue("Doesn't exist", traceFile.exists()); + assertTrue("Delete failed", traceFile.delete()); } return null; } @@ -2913,7 +2906,6 @@ public class J2EEDataSourceTest extends * There is a corresponding fixture for clientDataSource in DataSourceTest * * @throws SQLException - * NOTE: DISABLED until DERBY-4067 is fixed. */ public void testClientMessageTextConnectionAttribute() throws SQLException {