RE: Creating and setting DataSource without loading 'DomainNode.driver.xml' file.

From: noban (noba..andex.ru)
Date: Fri Jul 29 2005 - 11:29:02 EDT


  Got it. Thank`s a lot!

>BTW, here is a Wiki FAQ article on that:
>
>http://objectstyle.org/confluence/display/CAY/Setting+Database+Connection
>
>Lately I personally prefer a custom DataSourceFactory (briefly mentioned
>in the article above) that creates a "lazy" DataSource instance that pops
>a Swing login panel whenever the first connection is requested by the app.
>This is the cleanest solution IMO.
>
>Andrus
>
>
>> Why not include the DataNode XML (your DomainNode.driver.xml) file also?
>> You don't have to supply a valid username/password in it (you could even
>> leave it blank). (Of course, you should probably have the
>> adapter/driver/url/etc specified.) After they enter the
>> username/password, you can fill it in at runtime.
>>
>> To the best of my knowledge, Cayenne reads in the configuration
>> information and, if you have logging turned on, it *looks* like it is
>> connecting to the DB specified in the DataNode, but it isn't actually
>> doing it then (I believe it is just creating the connection pool). It
>> waits until it actually needs to do some SQL before it really connects.
>> So that gives you time to grab the DataNode and fill in the details.
>>
>> /dev/mrg
>>
>>
>> -----Original Message-----
>> From: noba..andex.ru [mailto:noban@yandex.ru]
>> Sent: Friday, July 29, 2005 7:07 AM
>> To: cayenne-use..bjectstyle.org
>> Subject: Creating and setting DataSource without loading
>> 'DomainNode.driver.xml' file.
>>
>>
>>
>> Hi!
>>
>> I`m writing desktop DataBase client. So I can`t install on end user
>> PC`s my application with "DomainNode.driver.xml" file inside. Because it
>> contains login & password. Therefore, as I inderstand, I need to create
>> dataSource on the fly, when user has provided Login & Password, and then
>> load this DataSource into Cayenne and retrieve DataContext.
>>
>> How can I do that? As I understand for setting DataSource first of
>> all I need to get configuration --->
>>
>> Configuration config = Configuration.getSharedConfiguration();
>>
>> but this doesn`t work because `getSharedConfiguration()` is loading all
>> necassary files and "DomainNode.driver.xml" as well.
>>
>> Does somebody have some hints on this?
>>
>

-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru



This archive was generated by hypermail 2.0.0 : Fri Jul 29 2005 - 11:29:17 EDT