aspose file tools*
The moose likes Struts and the fly likes How to configure hsqldb in struts 1.3.8? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to configure hsqldb in struts 1.3.8?" Watch "How to configure hsqldb in struts 1.3.8?" New topic
Author

How to configure hsqldb in struts 1.3.8?

Raghu ram
Ranch Hand

Joined: Oct 19, 2007
Posts: 34
Hello frnds,
Anybody please help me.
Am using Hypersonic sql database(that is HSQLDB) and struts 1.3.8 version am using.Anybody tell me to configure database in struts. Reply me soon
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There is nothing unique about using a database in a Struts application. The best practice is to configure a JNDI Data Source in your Application Server that points to your database and then use a JNDI lookup in your application code to find the Data Source and use it to establish a connection to the database. You would then use standard JDBC code to access the tables.

Earlier versions of Struts allowed you to configure an Apache Commons Data Source within the Struts config file. The authors of Struts, however, realized this was not a good idea, and they removed it from the latest versions of Struts.
[ March 05, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Raghu ram
Ranch Hand

Joined: Oct 19, 2007
Posts: 34
Hi Merrill Higginson,

Can you give me the code to get the datasource.
Please reply me soon dude.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
For information on how to use JNDI data sources in a J2EE application, see Chapter 31 of the Sun J2EE Tutorail. Basically, the code looks like this:

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to configure hsqldb in struts 1.3.8?