You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Dan Morgan <dm...@ihomefinder.com> on 2007/09/12 18:29:52 UTC

jdbc connection information

Is there a way to modify the JDBC connection information programmatically
prior to Cayenne attempting to make a connection?  With EOF you could get at
the connection information and make changes to it prior to connection.  This
allowed having property files that contained the connection information and
yet not have to make changes to the driver nodes (Allowed copying the same
jar file to several different configurations (staging, production, etc) and
just having different property files there which could be used to modify the
connection information at runtime).

Thanks,
 

Daniel L. Morgan  
EMail      : <dm...@ihomefinder.com>

 

 

 


Re: jdbc connection information

Posted by Andrus Adamchik <an...@objectstyle.org>.
BTW, I would recommend to try a JNDI option first. That's where  
WebObjects/EOF is different from J2EE - things like DataSources are  
normally provided by container (vs. application), with container- 
specific config replacing environment property files.

Andrus

On Sep 12, 2007, at 7:41 PM, Andrus Adamchik wrote:

> There is a variety of options for customization revolving around  
> JNDI [1], and a custom DataSource that can be configured via a  
> custom DataSourceFactory [2] in the Modeler.
>
> Cheers,
> Andrus
>
> [1] http://cayenne.apache.org/doc/using-jndi.html
> [2] http://cayenne.apache.org/doc/api/org/apache/cayenne/conf/ 
> DataSourceFactory.html
>
>
> On Sep 12, 2007, at 7:29 PM, Dan Morgan wrote:
>
>> Is there a way to modify the JDBC connection information  
>> programmatically
>> prior to Cayenne attempting to make a connection?  With EOF you  
>> could get at
>> the connection information and make changes to it prior to  
>> connection.  This
>> allowed having property files that contained the connection  
>> information and
>> yet not have to make changes to the driver nodes (Allowed copying  
>> the same
>> jar file to several different configurations (staging, production,  
>> etc) and
>> just having different property files there which could be used to  
>> modify the
>> connection information at runtime).
>>
>> Thanks,
>>
>>
>> Daniel L. Morgan
>> EMail      : <dm...@ihomefinder.com>
>>
>>
>>
>>
>>
>>
>>
>>
>
>


Re: [Likely Spam]Re: jdbc connection information

Posted by Andrus Adamchik <an...@objectstyle.org>.
"J2EE" is a broad term (note that I didn't mean EJB)... Are you  
deploying your application to Tomcat, Jetty, or something similar?  
Those are examples of a "J2EE web container". All of them support  
JNDI DataSources (see configuration examples in Cayenne docs per link  
below).

Andrus


On Sep 13, 2007, at 5:31 PM, Dan Morgan wrote:

> Not using J2EE - just POJO.
>
> Thanks,
> Dan
>
> -----Original Message-----
> From: Andrus Adamchik [mailto:andrus@objectstyle.org]
> Sent: Wednesday, September 12, 2007 9:48 AM
> To: dmorgan
> Subject: [Likely Spam]Re: jdbc connection information
>
> BTW, I would recommend to try a JNDI option first. That's where
> WebObjects/EOF is different from J2EE - things like DataSources are  
> normally
> provided by container (vs. application), with container- specific  
> config
> replacing environment property files.
>
> Andrus
>
> On Sep 12, 2007, at 7:41 PM, Andrus Adamchik wrote:
>
>> There is a variety of options for customization revolving around JNDI
>> [1], and a custom DataSource that can be configured via a custom
>> DataSourceFactory [2] in the Modeler.
>>
>> Cheers,
>> Andrus
>>
>> [1] http://cayenne.apache.org/doc/using-jndi.html
>> [2] http://cayenne.apache.org/doc/api/org/apache/cayenne/conf/
>> DataSourceFactory.html
>>
>>
>> On Sep 12, 2007, at 7:29 PM, Dan Morgan wrote:
>>
>>> Is there a way to modify the JDBC connection information
>>> programmatically prior to Cayenne attempting to make a connection?
>>> With EOF you could get at the connection information and make  
>>> changes
>>> to it prior to connection.  This allowed having property files that
>>> contained the connection information and yet not have to make  
>>> changes
>>> to the driver nodes (Allowed copying the same jar file to several
>>> different configurations (staging, production,
>>> etc) and
>>> just having different property files there which could be used to
>>> modify the connection information at runtime).
>>>
>>> Thanks,
>>>
>>>
>>> Daniel L. Morgan
>>> EMail      : <dm...@ihomefinder.com>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
>


Re: [Likely Spam]Re: jdbc connection information

Posted by Michael Gentry <bl...@gmail.com>.
Dan, do you use Ant to build your application?  I had a Tapestry
application using Cayenne that had a default DataNode XML file I used
for local testing, but when I ran Ant to build the WAR file, it would
copy an environment-specific DataNode XML file out of
environments/development/....xml (I also had testing, acceptance, and
production directories) to the build directory and package that into
the WAR.  So, depending on how I ran Ant, it would pull a different
DataNode XML file (with different connection settings) to build into
the WAR.  Worked fairly well for me.  (I also had different
.properties files, etc in those target-specific directories.)  Would
that approach work for you, too?

/dev/mrg


On 9/13/07, Dan Morgan <dm...@ihomefinder.com> wrote:
> Not using J2EE - just POJO.
>
> Thanks,
> Dan
>
> -----Original Message-----
> From: Andrus Adamchik [mailto:andrus@objectstyle.org]
> Sent: Wednesday, September 12, 2007 9:48 AM
> To: dmorgan
> Subject: [Likely Spam]Re: jdbc connection information
>
> BTW, I would recommend to try a JNDI option first. That's where
> WebObjects/EOF is different from J2EE - things like DataSources are normally
> provided by container (vs. application), with container- specific config
> replacing environment property files.
>
> Andrus
>
> On Sep 12, 2007, at 7:41 PM, Andrus Adamchik wrote:
>
> > There is a variety of options for customization revolving around JNDI
> > [1], and a custom DataSource that can be configured via a custom
> > DataSourceFactory [2] in the Modeler.
> >
> > Cheers,
> > Andrus
> >
> > [1] http://cayenne.apache.org/doc/using-jndi.html
> > [2] http://cayenne.apache.org/doc/api/org/apache/cayenne/conf/
> > DataSourceFactory.html
> >
> >
> > On Sep 12, 2007, at 7:29 PM, Dan Morgan wrote:
> >
> >> Is there a way to modify the JDBC connection information
> >> programmatically prior to Cayenne attempting to make a connection?
> >> With EOF you could get at the connection information and make changes
> >> to it prior to connection.  This allowed having property files that
> >> contained the connection information and yet not have to make changes
> >> to the driver nodes (Allowed copying the same jar file to several
> >> different configurations (staging, production,
> >> etc) and
> >> just having different property files there which could be used to
> >> modify the connection information at runtime).
> >>
> >> Thanks,
> >>
> >>
> >> Daniel L. Morgan
> >> EMail      : <dm...@ihomefinder.com>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
>
>
>

Re: jdbc connection information

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Sep 14, 2007, at 4:22 PM, Dan Morgan wrote:

> No I am not.  I'm running a straight POJO application, no container.
>
> Dan

Sure. Although your reference to POJO caused wrong associations  
("POJO" is also a broad term that can refer to almost anything these  
days... Heh, I thought my webapps were POJO? ;-)).

Then DriverDataSourceFactory is the extension point you can use.

Andrus

RE: [Likely Spam]Re: jdbc connection information

Posted by Dan Morgan <dm...@ihomefinder.com>.
No I am not.  I'm running a straight POJO application, no container.

Dan 

-----Original Message-----
From: Andrus Adamchik [mailto:andrus@objectstyle.org] 
Sent: Thursday, September 13, 2007 7:51 AM
To: dmorgan
Subject: Re: [Likely Spam]Re: jdbc connection information

"J2EE" is a broad term (note that I didn't mean EJB)... Are you deploying
your application to Tomcat, Jetty, or something similar?  
Those are examples of a "J2EE web container". All of them support JNDI
DataSources (see configuration examples in Cayenne docs per link below).

Andrus


On Sep 13, 2007, at 5:31 PM, Dan Morgan wrote:

> Not using J2EE - just POJO.
>
> Thanks,
> Dan
>
> -----Original Message-----
> From: Andrus Adamchik [mailto:andrus@objectstyle.org]
> Sent: Wednesday, September 12, 2007 9:48 AM
> To: dmorgan
> Subject: [Likely Spam]Re: jdbc connection information
>
> BTW, I would recommend to try a JNDI option first. That's where 
> WebObjects/EOF is different from J2EE - things like DataSources are 
> normally provided by container (vs. application), with container- 
> specific config replacing environment property files.
>
> Andrus
>
> On Sep 12, 2007, at 7:41 PM, Andrus Adamchik wrote:
>
>> There is a variety of options for customization revolving around JNDI 
>> [1], and a custom DataSource that can be configured via a custom 
>> DataSourceFactory [2] in the Modeler.
>>
>> Cheers,
>> Andrus
>>
>> [1] http://cayenne.apache.org/doc/using-jndi.html
>> [2] http://cayenne.apache.org/doc/api/org/apache/cayenne/conf/
>> DataSourceFactory.html
>>
>>
>> On Sep 12, 2007, at 7:29 PM, Dan Morgan wrote:
>>
>>> Is there a way to modify the JDBC connection information 
>>> programmatically prior to Cayenne attempting to make a connection?
>>> With EOF you could get at the connection information and make 
>>> changes to it prior to connection.  This allowed having property 
>>> files that contained the connection information and yet not have to 
>>> make changes to the driver nodes (Allowed copying the same jar file 
>>> to several different configurations (staging, production,
>>> etc) and
>>> just having different property files there which could be used to 
>>> modify the connection information at runtime).
>>>
>>> Thanks,
>>>
>>>
>>> Daniel L. Morgan
>>> EMail      : <dm...@ihomefinder.com>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
>


RE: [Likely Spam]Re: jdbc connection information

Posted by Dan Morgan <dm...@ihomefinder.com>.
Not using J2EE - just POJO.

Thanks,
Dan 

-----Original Message-----
From: Andrus Adamchik [mailto:andrus@objectstyle.org] 
Sent: Wednesday, September 12, 2007 9:48 AM
To: dmorgan
Subject: [Likely Spam]Re: jdbc connection information

BTW, I would recommend to try a JNDI option first. That's where
WebObjects/EOF is different from J2EE - things like DataSources are normally
provided by container (vs. application), with container- specific config
replacing environment property files.

Andrus

On Sep 12, 2007, at 7:41 PM, Andrus Adamchik wrote:

> There is a variety of options for customization revolving around JNDI 
> [1], and a custom DataSource that can be configured via a custom 
> DataSourceFactory [2] in the Modeler.
>
> Cheers,
> Andrus
>
> [1] http://cayenne.apache.org/doc/using-jndi.html
> [2] http://cayenne.apache.org/doc/api/org/apache/cayenne/conf/
> DataSourceFactory.html
>
>
> On Sep 12, 2007, at 7:29 PM, Dan Morgan wrote:
>
>> Is there a way to modify the JDBC connection information 
>> programmatically prior to Cayenne attempting to make a connection?  
>> With EOF you could get at the connection information and make changes 
>> to it prior to connection.  This allowed having property files that 
>> contained the connection information and yet not have to make changes 
>> to the driver nodes (Allowed copying the same jar file to several 
>> different configurations (staging, production,
>> etc) and
>> just having different property files there which could be used to 
>> modify the connection information at runtime).
>>
>> Thanks,
>>
>>
>> Daniel L. Morgan
>> EMail      : <dm...@ihomefinder.com>
>>
>>
>>
>>
>>
>>
>>
>>
>
>



Re: jdbc connection information

Posted by Andrus Adamchik <an...@objectstyle.org>.
There is a variety of options for customization revolving around JNDI  
[1], and a custom DataSource that can be configured via a custom  
DataSourceFactory [2] in the Modeler.

Cheers,
Andrus

[1] http://cayenne.apache.org/doc/using-jndi.html
[2] http://cayenne.apache.org/doc/api/org/apache/cayenne/conf/ 
DataSourceFactory.html


On Sep 12, 2007, at 7:29 PM, Dan Morgan wrote:

> Is there a way to modify the JDBC connection information  
> programmatically
> prior to Cayenne attempting to make a connection?  With EOF you  
> could get at
> the connection information and make changes to it prior to  
> connection.  This
> allowed having property files that contained the connection  
> information and
> yet not have to make changes to the driver nodes (Allowed copying  
> the same
> jar file to several different configurations (staging, production,  
> etc) and
> just having different property files there which could be used to  
> modify the
> connection information at runtime).
>
> Thanks,
>
>
> Daniel L. Morgan
> EMail      : <dm...@ihomefinder.com>
>
>
>
>
>
>
>
>