*/
public void testClientDSConnectionAttributes() throws Exception {
if (usingEmbedded())
return;
ClientDataSourceInterface ds = null;
if (JDBC.vmSupportsJNDI()) {
// Use reflection to avoid class not found in non-JNDI context
ds = (ClientDataSourceInterface)Class.forName(
"org.apache.derby.jdbc.ClientDataSource").newInstance();
} else {
ds = (ClientDataSourceInterface)Class.forName(
"org.apache.derby.jdbc.BasicClientDataSource40").
newInstance();
}
ds.setPortNumber(TestConfiguration.getCurrent().getPort());
// DataSource - EMPTY; expect error 08001 in all cases
// 08001: Required Derby DataSource property databaseName not set.
dsConnectionRequests(new String[]
{"08001","08001","08001","08001",
"08001","08001","08001","08001","08001"}, ds);
// DataSource - connectionAttributes=databaseName=<valid name>
ds.setConnectionAttributes("databaseName=" + dbName);
dsConnectionRequests(new String[]
{"08001","08001","08001","08001",
"08001","08001","08001","08001","08001"}, ds);
ds.setConnectionAttributes(null);
// Test that (invalid) database name specified in connection
// attributes is not used
// DataSource - databaseName=<valid db> and
// connectionAttributes=databaseName=kangaroo
ds.setConnectionAttributes("databaseName=kangaroo");
ds.setDatabaseName(dbName);
dsConnectionRequests(new String[]
{"OK","08001","OK","OK",
"08001","08001","OK","OK","OK"}, ds);
ds.setConnectionAttributes(null);
ds.setDatabaseName(null);
} // End testClientDSConnectionAttributes