If you're running on a container that supports it (which means any J2EE
container plus Tomcat 4), using JNDI resources is the right way to deal
with this.  Essentially, you declare a "resource reference" to a data
source in your web.xml file, and then configure the database access
details in your server's configuration file.

The configuration process is container-specific -- here's the docs on
using Tomcat (which also includes programming examples for accessing the
data source):

  http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

Craig


On Thu, 19 Sep 2002, Kirby Vandivort wrote:

> Date: Thu, 19 Sep 2002 09:37:10 -0500
> From: Kirby Vandivort <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Database access deployment question
>
> Hello,
>
> I have been reading up on accessing databases from within the struts
> framework, and I'm not totally sure of the best way to approach the
> issue of deployment.
>
> We package up a WAR file for distribution to end users, and I would
> like to be able to tell them to drop the WAR file in webapps and be
> done with it.  (ie., not have to uncompress it).
>
> However, from what I can tell, setting up "clean" database access
> includes doing something like making a data-source entry and placing it
> in the web.xml in the WEB-INF directory of the deployed application.
>
> Since the properties for the database (username, password, etc) will be
> different for each end user, I can't apriori set values for this.
>
> So, what does everyone out there that has been down this road before do
> to solve this problem?  I guess, really, this goes beyond simple
> database access.  We also have a few other settings for our application
> that need to be set.
>
> CURRENTLY, we aren't using struts (pure servlets) and we have properties
> files that contain this information.  But, we are currently requiring
> the user to unpack the WAR file and I would love to get away from this.
>
> Thanks for your help!
>
> --
>
> Kirby Vandivort                      Theoretical Biophysics Group
> Email: [EMAIL PROTECTED]          3051 Beckman Institute
> http://www.ks.uiuc.edu/~kvandivo/    University of Illinois
> Phone: (217) 244-5711                405 N. Mathews Ave
> Fax  : (217) 244-6078                Urbana, IL  61801, USA
>
> --
> 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]>

Reply via email to