JavaRanch Home
 
Front Page FAQs Ranchers Categories Recent Changes To Do Upload

Struts Data Source   



The recommended way to access data in any J2EE application is through a "Data Source". A Data Source is an object that represents a "pool" of database connections that are managed by the application server or some other process.

Although earlier versions of Struts have a utility for setting up a DataSource in the struts-config.xml file, I'd strongly advise you not to use it. It's deprecated in later versions, and it just plain doesn't work very well.

The best practice for using a database in any J2EE application is to set up a DataSource in the Application Server's Java Naming and Directory Interface (JNDI), and then use JNDI in your application to "look up" the DataSource and use it. The process for setting up a DataSource in JNDI is a little different for each application server. Consult the documentation for the App server you're using for instructions on how to do it.

If you're using Tomcat 5 or above, this link should help.


Return to StrutsFaq
Front Page FAQs Ranchers Categories Recent Changes To Do Upload
Last Edited: 28 March 2007 What's Changed?
 
Copyright © 1998-2008 Paul Wheaton | Home | About Us | Privacy | Register