On 28. mars 2014, at 17:28, Rick Hillegas <[email protected]> wrote:

> On 3/28/14 6:05 AM, Dyre Tjeldvoll wrote:
>> Hi,
>> 
>> I'm faced with a situation where I'm passed a Derby connection object and 
>> would like to create another connection to the same database.
>> 
>> Through DatabaseMetaData.getURL() I can get the "base url", i.e. just the 
>> protocol and the database file name. But is there a way to get the 
>> properties used to create the connection? Without the properties it may not 
>> be possible to connect to the "base URL", e.g. if original connection was to 
>> an encrypted database.
> Hi Dyre,
> 
> Not that I'm aware of. The DataSource abstraction is useful for remembering 
> this kind of context.

That might just do the trick in this case. The connection is being passed as an 
Object, and I don’t think anything prevents me from passing a DataSource 
instead. Thanks.

> But Connections don't give you this kind of metadata. Maybe you could add a 
> cloneMe() method to EmbedConnection. Retrieving the connection attributes 
> would raise some interesting security problems. E.g., handing back the 
> original password in cleartext sounds dangerous to me.

Agree, this sounds like a non-starter.

Regards,

Dyre

Reply via email to