db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Wilder <0505...@acadiau.ca>
Subject Re: connectionAttributes overriding DataSource properties??
Date Wed, 06 Jul 2005 14:09:20 GMT
While I'm not sure if this is particularly relevant I thought I might 
point out that I do some simple tests of this issue in 
dataSourcePermissions_net.java as part of the (future) Derby-406 Fix. It 
might be possibly to piggyback on this functionality for more extensive 


Dan Debrunner wrote:

>Any thoughts on what the behaviour should be for a Derby data source if
>attributes in the connectionAttributes property conflict with other
>properties of the data source? E.g. with a Derby datasource I can have
>With both embedded and client DataSource implementations a
>DataSource.getConnection() request obtains a connection with user name
>barney. However there is a bug in ClientDataSource where the first
>connection attempt using getConnection() creates a NetConnection object
>passing in the user name as fred. On a simple test doesn't seem to cause
>any problems but I'm sure there are bugs where part of the system thinks
>the user is fred and part barney.
>What about DataSource.getConnection("wilma", "password")?
>Again with user set in connectionAttributes, the user name becomes
>barney. And again in the ClientDataSource case the NetConnection will be
>created with the name wilma.
>Note user is just an example here, any other data source property that
>can also be set as a jdbc attribute has this problem. ClientDataSource
>also updates its properties from the connectionAttributes on its first
>connection attempt, though not all the properties, only a partial set.
>I'm not sure this updating (method updateDataSourceValues) should take
>place, it is partially responsible for the bug above.
>The DriverManager has the same problem, though in this case it is
>limited to user and password, e.g. both of these connect as barney.
>DriverManager.getConnection("jdbc:derby:wombat;user=barney", "wilma",
>p.put("user", "fred");
>testDS(DriverManager.getConnection("jdbc:derby:wombat;user=barney", p));
>For the DriveManager case, this page does state that the attributes
>provided in the embedded URL will be added to the set passed to the
>getConnection call. This could imply that the ones on the URL override
>those in the set, would be nice to state here what is meant to happen if
>the property exists in both places.
>The DriverManager/Driver classes enforce that the user and password
>passed in explicitly (DriverManager.getConnection(user,password) and
>passed into Derby as 'user' and 'password' properties in a properties
>object. Thus Derby can not determine if the user was supplied explicitly
>or by a properties object.
>To my mind, with a DataSource connectionAttributes should only be used
>for cases where the attribute can not be set as a property, thus their
>value should be ignored or overridden by any explict setting.

View raw message