Issue Details (XML | Word | Printable)

Key: DERBY-1130
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Deepa Remesh
Reporter: Kathey Marsden
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Client should not allow databaseName to be set with setConnectionAttributes

Created: 21/Mar/06 12:27 AM   Updated: 30/Jun/09 04:12 PM
Return to search
Component/s: Network Client
Affects Version/s: 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6
Fix Version/s: 10.2.2.1

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works d1130-client-v1.diff 2006-08-07 07:26 PM Deepa Remesh 15 kB
File Licensed for inclusion in ASF works d1130-client-v1.status 2006-08-07 07:26 PM Deepa Remesh 0.6 kB
File Licensed for inclusion in ASF works d1130-test-dataSourceReference.diff 2006-08-11 04:36 PM Deepa Remesh 11 kB
File Licensed for inclusion in ASF works d1130-test-dataSourceReference.status 2006-08-11 04:36 PM Deepa Remesh 0.3 kB
File Licensed for inclusion in ASF works d1130-v2.diff 2006-08-12 08:53 PM Deepa Remesh 23 kB
File Licensed for inclusion in ASF works d1130-v2.status 2006-08-12 08:53 PM Deepa Remesh 0.5 kB
File Licensed for inclusion in ASF works derby-1130-v1.diff 2006-07-17 09:58 PM Deepa Remesh 20 kB
File Licensed for inclusion in ASF works derby-1130-v1.status 2006-07-17 09:58 PM Deepa Remesh 0.4 kB

Issue & fix info: Release Note Needed
Resolution Date: 15/May/07 07:50 PM


 Description  « Hide
Per this thread, setConnectionAttributes should not set databaseName.

http://www.nabble.com/double-check-on-checkDataSource-t1187602.html#a3128621

Currently this is allowed for client but should be disabled. I think it is OK to change because we have documented that client will be changed to match embedded for implementation defined behaviour. Hopefully its use is rare as most folks would use the standard setDatabaseName. Still there should be a release not when the change is made and it would be better to change it sooner than later:

Below is the repro.

Here is the output with Client
D>java DatabaseNameWithSetConnAttr
ds.setConnectionAttributes(databaseName=wombat;create=true)
ds.getDatabaseName() = null (should be null)
FAIL: Should not have been able to set databaseName with connection attributes

Also look for tests disabled with this bug number in the test checkDataSource30.java



import java.sql.*;
import java.lang.reflect.Method;


public class DatabaseNameWithSetConnAttr{

public static void main(String[] args) {
try {

String attributes = "databaseName=wombat;create=true";
org.apache.derby.jdbc.ClientDataSource ds = new
org.apache.derby.jdbc.ClientDataSource();

//org.apache.derby.jdbc.EmbeddedDataSource ds = new
//org.apache.derby.jdbc.EmbeddedDataSource();
System.out.println("ds.setConnectionAttributes(" + attributes + ")");
ds.setConnectionAttributes(attributes);
System.out.println("ds.getDatabaseName() = " +
ds.getDatabaseName() + " (should be null)" );

Connection conn = ds.getConnection();

} catch (SQLException e) {
String sqlState = e.getSQLState();
if (sqlState != null && sqlState.equals("XJ041"))
{
System.out.println("PASS: An exception was thrown trying to get a connetion from a datasource after setting databaseName with setConnectionAttributes");
System.out.println("EXPECTED EXCEPTION: " + e.getSQLState()
+ " - " + e.getMessage());
return;
}
while (e != null)
{
System.out.println("FAIL - UNEXPECTED EXCEPTION: " + e.getSQLState());
e.printStackTrace();
e = e.getNextException();
}
return;
}
System.out.println("FAIL: Should not have been able to set databaseName with connection attributes");

}

}


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Deepa Remesh made changes - 12/Jul/06 06:21 AM
Field Original Value New Value
Assignee Deepa Remesh [ deepa ]
Deepa Remesh made changes - 17/Jul/06 09:58 PM
Attachment derby-1130-v1.diff [ 12337063 ]
Attachment derby-1130-v1.status [ 12337064 ]
Deepa Remesh made changes - 17/Jul/06 09:59 PM
Derby Info [Patch Available]
Deepa Remesh made changes - 26/Jul/06 08:22 PM
Derby Info [Patch Available]
Deepa Remesh made changes - 07/Aug/06 07:26 PM
Attachment d1130-client-v1.status [ 12338311 ]
Attachment d1130-client-v1.diff [ 12338310 ]
Deepa Remesh made changes - 07/Aug/06 07:31 PM
Fix Version/s 10.2.0.0 [ 11187 ]
Derby Info [Patch Available]
Kathey Marsden made changes - 11/Aug/06 03:37 AM
Derby Info [Patch Available] [Existing Application Impact, Release Note Needed]
Deepa Remesh made changes - 11/Aug/06 04:36 PM
Attachment d1130-test-dataSourceReference.status [ 12338711 ]
Attachment d1130-test-dataSourceReference.diff [ 12338710 ]
Deepa Remesh made changes - 11/Aug/06 04:37 PM
Derby Info [Existing Application Impact, Release Note Needed] [Patch Available, Existing Application Impact, Release Note Needed]
Deepa Remesh made changes - 11/Aug/06 07:53 PM
Derby Info [Release Note Needed, Existing Application Impact, Patch Available] [Existing Application Impact, Release Note Needed]
Sunitha Kambhampati made changes - 11/Aug/06 08:20 PM
Link This issue relates to DERBY-1661 [ DERBY-1661 ]
Sunitha Kambhampati made changes - 11/Aug/06 08:27 PM
Link This issue relates to DERBY-1661 [ DERBY-1661 ]
Deepa Remesh made changes - 12/Aug/06 08:53 PM
Attachment d1130-v2.status [ 12338753 ]
Attachment d1130-v2.diff [ 12338752 ]
Deepa Remesh made changes - 16/Aug/06 09:40 PM
Derby Info [Existing Application Impact, Release Note Needed] [Patch Available, Existing Application Impact, Release Note Needed]
Mike Matrigali made changes - 28/Aug/06 08:18 PM
Derby Info [Patch Available, Release Note Needed, Existing Application Impact] [Patch Available, Existing Application Impact, Release Note Needed]
Mike Matrigali made changes - 29/Aug/06 05:24 PM
Derby Info [Release Note Needed, Patch Available, Existing Application Impact] [Patch Available, Existing Application Impact, Release Note Needed]
Mike Matrigali made changes - 01/Sep/06 07:49 PM
Derby Info [Release Note Needed, Patch Available, Existing Application Impact] [Patch Available, Existing Application Impact, Release Note Needed]
Fix Version/s 10.3.0.0 [ 12310800 ]
Mike Matrigali made changes - 01/Sep/06 07:52 PM
Derby Info [Release Note Needed, Patch Available, Existing Application Impact] [Patch Available, Existing Application Impact, Release Note Needed]
Deepa Remesh made changes - 01/Sep/06 09:17 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Derby Info [Release Note Needed, Patch Available, Existing Application Impact] [Patch Available, Existing Application Impact, Release Note Needed]
Kathey Marsden made changes - 14/May/07 04:35 PM
Status Resolved [ 5 ] Closed [ 6 ]
Rick Hillegas made changes - 15/May/07 07:47 PM
Status Closed [ 6 ] Reopened [ 4 ]
Resolution Fixed [ 1 ]
Rick Hillegas made changes - 15/May/07 07:49 PM
Derby Info [Release Note Needed, Patch Available, Existing Application Impact] [Patch Available, Existing Application Impact, Release Note Needed]
Fix Version/s 10.3.0.0 [ 12310800 ]
Fix Version/s 10.2.2.1 [ 12312251 ]
Fix Version/s 10.2.1.6 [ 11187 ]
Rick Hillegas made changes - 15/May/07 07:50 PM
Resolution Fixed [ 1 ]
Derby Info [Release Note Needed, Existing Application Impact, Patch Available] [Patch Available, Existing Application Impact, Release Note Needed]
Status Reopened [ 4 ] Closed [ 6 ]
Dag H. Wanvik made changes - 30/Jun/09 04:12 PM
Issue & fix info [Existing Application Impact, Release Note Needed, Patch Available] [Release Note Needed]