On Tue, 30 Apr 2002, Eddie Bush wrote:
> Date: Tue, 30 Apr 2002 12:08:24 -0500
> From: Eddie Bush <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: Re: datasources
>
> Ok, checkout, modify, and check back in the struts-config.xml. Then, you'd
> get what you want from your source control system. ... or is there some
> reason you can't do that? If you have to put notes in for changes just
> state that you modified the datasource for production or that you modified
> the datasource for development ... or something like that. I don't see why
> that wouldn't work, but you may well throw another wrench into my plan.
>
Another way to deal with the "different data sources in development and
production" issue is to use the JNDI resources facilities of your app
server instead. That way, your application would always use a symbolic
reference to a particular data source (defined with a <resource-ref> or
<resource-env-ref> element in web.xml), which would be connected to the
correct database at deployment time via appropriate app server
configuration settings.
All J2EE app servers support this facility, plus several other basic
servlet containers (including Tomcat 4 -- see the
"jndi-resources-howto.html" file in the Tomcat 4 documentation).
> If you're unable to modify the config file, repost with a different subject.
> Something like ... "How do I initialize a datasource?" Surely you'll get
> more attention then.
>
> HTH!
>
> Eddie
>
Craig
> ----- Original Message -----
> From: "Ramin, Arash" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, April 29, 2002 11:39 AM
> Subject: RE: datasources
>
>
> > The problem with this is that the next time we run a build the latest
> > struts-config.xml is retrieved from source control. I know I can create
> the
> > datasource manually on initialization, but I'm trying to let Struts handle
> > it somehow as you suggest.
> >
> > - Arash
> >
> > > -----Original Message-----
> > > From: Eddie Bush [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, April 29, 2002 12:24
> > > To: Struts Users Mailing List
> > > Subject: Re: datasources
> > >
> > >
> > > You could always comment one of them out, depending on which
> > > environment you're running in, and save yourself having to do
> > > anything else =)
> > >
> > > ... I'm lazy though.
> > >
> > > Just surround the definition you don't want initialized with:
> > >
> > > <!--
> > > You just made your datasource definition a comment.
> > > Restart Tomcat =)
> > > -->
> > >
> > > You'll have to look to another person to provide you a way to
> > > initialize the datasource yourself if you don't like my
> > > suggestion. I tend to let Struts do whatever it can for me.
> > >
> > > HTH,
> > >
> > > Eddie
> > >
> > > ----- Original Message -----
> > > From: "Ramin, Arash" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Monday, April 29, 2002 9:55 AM
> > > Subject: datasources
> > >
> > >
> > > >
> > > > We have a couple datasources defined in our application (in
> > > > struts-config.xml) under separate keys (one is for our dev
> > > > environment,
> > > and
> > > > the other for production). The default behaviour for Struts is to
> > > > initialize all the defined datasources and make them
> > > available to the
> > > > application. Depending on which environment we're running in, only
> > > > one of them should be initialized.
> > > >
> > > > Can I tell Struts not to initialize the datasources
> > > automatically so I
> > > > can do it manually in my own servlet? I already have a constant
> > > > defined in a resource file so my application can determine which
> > > > datasource to use.
> > > Any
> > > > suggestions?
> > > >
> > > > (Struts 1.1 beta 1, Tomcat 4.03, Sun JDK 1.3.1)
> > > >
> > > > Thanks,
> > > >
> > > > Arash
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-user-> [EMAIL PROTECTED]>
> > > For
> > > additional commands,
> > > e-mail: <mailto:[EMAIL PROTECTED]>
> > >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>