You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2006/08/11 22:50:30 UTC
svn commit: r430891 - in /db/derby/code/trunk/java:
client/org/apache/derby/jdbc/ engine/org/apache/derby/loc/
shared/org/apache/derby/shared/common/reference/
testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/
testing/org/apache/derb...
Author: kmarsden
Date: Fri Aug 11 13:50:29 2006
New Revision: 430891
URL: http://svn.apache.org/viewvc?rev=430891&view=rev
Log:
Backout change for
DERBY-1130 Client should not allow databaseName to be set with setConnectionAttributes
To address concerns with the patch
Modified:
db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java
db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientDataSource.java
db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java?rev=430891&r1=430890&r2=430891&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java Fri Aug 11 13:50:29 2006
@@ -31,7 +31,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.sql.SQLException;
import javax.naming.RefAddr;
import javax.naming.Referenceable;
@@ -800,24 +799,15 @@
* Any attributes that can be set using a property of this DataSource implementation
* (e.g user, password) should not be set in connectionAttributes. Conflicting
* settings in connectionAttributes and properties of the DataSource will lead to
- * unexpected behaviour. Specifically, databaseName attribute cannot be set using
- * this method. (DERBY-1130). databaseName has to be set using the DataSource
- * property.
+ * unexpected behaviour.
*
* @param prop set to the list of Cloudscape connection attributes separated by semi-colons. E.g., to specify an
* encryption bootPassword of "x8hhk2adf", and set upgrade to true, do the following: <PRE>
* ds.setConnectionAttributes("bootPassword=x8hhk2adf;upgrade=true"); </PRE> See Derby documentation for
* complete list.
- * @throws SQLException if we attempt to set databaseName property in the connection attributes
*/
- public final void setConnectionAttributes(String prop) throws SQLException {
+ public final void setConnectionAttributes(String prop) {
connectionAttributes = prop;
-
- try {
- updateDataSourceValues(tokenizeAttributes(prop, null));
- } catch(SqlException se) {
- throw se.getSQLException();
- }
}
/**
@@ -895,15 +885,9 @@
* The dataSource keeps individual fields for the values that are relevant to the client. These need to be updated
* when set connection attributes is called.
*/
- void updateDataSourceValues(Properties prop) throws SqlException {
+ void updateDataSourceValues(Properties prop) {
if (prop == null) {
return;
- }
-
- if (prop.containsKey(Attribute.DBNAME_ATTR)) {
- throw new SqlException(null,
- new ClientMessageId(SQLState.ATTRIBUTE_NOT_ALLOWED),
- Attribute.DBNAME_ATTR);
}
if (prop.containsKey(Attribute.USERNAME_ATTR)) {
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=430891&r1=430890&r2=430891&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 Fri Aug 11 13:50:29 2006
@@ -182,6 +182,7 @@
try
{
LogWriter dncLogWriter = super.computeDncLogWriterForNewConnection("_sds");
+ updateDataSourceValues(tokenizeAttributes(getConnectionAttributes(), null));
return ClientDriver.getFactory().newNetConnection
((NetLogWriter) dncLogWriter, user,
password, this, -1, false);
Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties?rev=430891&r1=430890&r2=430891&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties Fri Aug 11 13:50:29 2006
@@ -1281,7 +1281,6 @@
XJ213.C=The traceLevel connection property does not have a valid format for a number.
XJ214.S=An IO Error occurred when calling free() on a CLOB or BLOB.
XJ215.S=You cannot invoke other Clob/Blob methods after calling free.
-XJ216.S={0} attribute cannot be set using the DataSource method setConnectionAttributes.
#XN - Network level messages
XN001.S=Connection reset is not allowed when inside a unit of work.
Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=430891&r1=430890&r2=430891&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java (original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java Fri Aug 11 13:50:29 2006
@@ -1490,7 +1490,6 @@
String TRACELEVEL_FORMAT_INVALID = "XJ213.C";
String IO_ERROR_UPON_LOB_FREE = "XJ214.S";
String LOB_OBJECT_INVALID = "XJ215.S";
- String ATTRIBUTE_NOT_ALLOWED = "XJ216.S";
//XN - Network-level messages
String NET_CONNECTION_RESET_NOT_ALLOWED_IN_UNIT_OF_WORK = "XN001.S";
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out?rev=430891&r1=430890&r2=430891&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out Fri Aug 11 13:50:29 2006
@@ -555,41 +555,4 @@
acxs 3
testing jira 95 for DataSource; ok - expected exception: XCY00
testing jira 95 for XADataSource; ok - expected exception: XCY00
-DataSource - EMPTY
- getConnection() - 08001:Required property databaseName not set.
- getConnection(null, null) - 08001:Required property databaseName not set.
- getConnection(fred, null) - 08001:Required property databaseName not set.
- getConnection(fred, wilma) - 08001:Required property databaseName not set.
- getConnection(null, wilma) - 08001:Required property databaseName not set.
- getConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
- getConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
- getConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
- getConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-DataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes.
-ConnectionPoolDataSource - EMPTY
- getPooledConnection() - 08001:Required property databaseName not set.
- getPooledConnection(null, null) - 08001:Required property databaseName not set.
- getPooledConnection(fred, null) - 08001:Required property databaseName not set.
- getPooledConnection(fred, wilma) - 08001:Required property databaseName not set.
- getPooledConnection(null, wilma) - 08001:Required property databaseName not set.
- getPooledConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
- getPooledConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
- getPooledConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
- getPooledConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-ConnectionPoolDataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes.
-XADataSource - EMPTY
- getXAConnection() - 08001:Required property databaseName not set.
- getXAConnection(null, null) - 08001:Required property databaseName not set.
- getXAConnection(fred, null) - 08001:Required property databaseName not set.
- getXAConnection(fred, wilma) - 08001:Required property databaseName not set.
- getXAConnection(null, wilma) - 08001:Required property databaseName not set.
- getXAConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
- getXAConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
- getXAConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
- getXAConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-XADataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes.
-Checked class declared as: javax.sql.DataSource
Completed checkDataSource
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out?rev=430891&r1=430890&r2=430891&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out Fri Aug 11 13:50:29 2006
@@ -672,42 +672,6 @@
acxs 3
testing jira 95 for DataSource; ok - expected exception: XCY00
testing jira 95 for XADataSource; ok - expected exception: XCY00
-DataSource - EMPTY
- getConnection() - 08001:Required property databaseName not set.
- getConnection(null, null) - 08001:Required property databaseName not set.
- getConnection(fred, null) - 08001:Required property databaseName not set.
- getConnection(fred, wilma) - 08001:Required property databaseName not set.
- getConnection(null, wilma) - 08001:Required property databaseName not set.
- getConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
- getConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
- getConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
- getConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-DataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes.
-ConnectionPoolDataSource - EMPTY
- getPooledConnection() - 08001:Required property databaseName not set.
- getPooledConnection(null, null) - 08001:Required property databaseName not set.
- getPooledConnection(fred, null) - 08001:Required property databaseName not set.
- getPooledConnection(fred, wilma) - 08001:Required property databaseName not set.
- getPooledConnection(null, wilma) - 08001:Required property databaseName not set.
- getPooledConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
- getPooledConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
- getPooledConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
- getPooledConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-ConnectionPoolDataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes.
-XADataSource - EMPTY
- getXAConnection() - 08001:Required property databaseName not set.
- getXAConnection(null, null) - 08001:Required property databaseName not set.
- getXAConnection(fred, null) - 08001:Required property databaseName not set.
- getXAConnection(fred, wilma) - 08001:Required property databaseName not set.
- getXAConnection(null, wilma) - 08001:Required property databaseName not set.
- getXAConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
- getXAConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
- getXAConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
- getXAConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-XADataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes.
START XA HOLDABILITY TEST
By default, autocommit is true for a connection
Default holdability for a connection is HOLD_CURSORS_OVER_COMMIT
@@ -776,5 +740,4 @@
Get a new connection with XAConnection.getConnection()
Isolation level should be reset to READ_COMMITTED
PASS: Expected lock timeout for READ_COMMITTED
-Checked class declared as: javax.sql.DataSource
Completed checkDataSource30
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?rev=430891&r1=430890&r2=430891&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java Fri Aug 11 13:50:29 2006
@@ -47,10 +47,6 @@
import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource;
import org.apache.derby.jdbc.EmbeddedDataSource;
import org.apache.derby.jdbc.EmbeddedXADataSource;
-import org.apache.derby.jdbc.ClientConnectionPoolDataSource;
-import org.apache.derby.jdbc.ClientDataSource;
-import org.apache.derby.jdbc.ClientXADataSource;
-
import org.apache.derby.tools.JDBCDisplayUtil;
import org.apache.derby.tools.ij;
import org.apache.derbyTesting.functionTests.util.SecurityCheck;
@@ -690,12 +686,10 @@
} catch (Exception e) {
System.out.println("; wrong, unexpected exception: " + e.toString());
}
-
- // DERBY-1130 - Client should not allow databaseName to be set with setConnectionAttributes
- if (TestUtil.isDerbyNetClientFramework())
- testClientDSConnectionAttributes();
-
- // skip testDSRequestAuthentication for client because of this issue:
+ // skip testDSRequestAuthentication for client because of these
+ // two issues:
+ // DERBY-1130 : Client should not allow databaseName to be set with
+ // setConnectionAttributes
// DERBY-1131 : Deprecate Derby DataSource property attributesAsPassword
if (TestUtil.isDerbyNetClientFramework())
return;
@@ -1389,53 +1383,6 @@
xads.setDatabaseName(null);
}
- /**
- * Check that database name cannot be set using setConnectionAttributes
- * for Derby client data sources. This method tests DERBY-1130.
- *
- * @throws SQLException
- */
- private static void testClientDSConnectionAttributes() throws SQLException {
-
- ClientDataSource ds = new ClientDataSource();
-
- System.out.println("DataSource - EMPTY");
- dsConnectionRequests(ds);
-
- System.out.println("DataSource - connectionAttributes=databaseName=wombat");
- try{
- ds.setConnectionAttributes("databaseName=wombat");
- } catch (SQLException sqle) {
- System.out.println("Expected exception - " + sqle.getMessage());
- }
-
-
- // now with ConnectionPoolDataSource
- ClientConnectionPoolDataSource cpds = new ClientConnectionPoolDataSource();
- System.out.println("ConnectionPoolDataSource - EMPTY");
- dsConnectionRequests((ConnectionPoolDataSource)cpds);
-
- System.out.println("ConnectionPoolDataSource - connectionAttributes=databaseName=wombat");
- try {
- cpds.setConnectionAttributes("databaseName=wombat");
- } catch (SQLException sqle) {
- System.out.println("Expected exception - " + sqle.getMessage());
- }
-
- // now with XADataSource
- ClientXADataSource xads = new ClientXADataSource();
- System.out.println("XADataSource - EMPTY");
- dsConnectionRequests((XADataSource) xads);
-
- System.out.println("XADataSource - connectionAttributes=databaseName=wombat");
- try {
- xads.setConnectionAttributes("databaseName=wombat");
- } catch (SQLException sqle) {
- System.out.println("Expected exception - " + sqle.getMessage());
- }
-
- }
-
private static void dsConnectionRequests(DataSource ds) {
SecurityCheck.inspect(ds, "javax.sql.DataSource");