Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to configure hsqldb in struts 1.3.8?

 
Raghu ram
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Raghu ram
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Merrill Higginson,

Can you give me the code to get the datasource.
Please reply me soon dude.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic