wood burning stoves
The moose likes Struts and the fly likes configuring datasource in struts-config.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "configuring datasource in struts-config.xml" Watch "configuring datasource in struts-config.xml" New topic

configuring datasource in struts-config.xml

Mark Henryson
Ranch Hand

Joined: Jul 11, 2005
Posts: 200
I am learning Struts and I want how to configure the data source in struts-config.xml. i.e., connection to a database. it can be either oracle / sql server. I am trying to add the username and password in the DB. (all the action, actionforms are ready). pls tell / sample site for configuring db in struts-config.xml
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Check out the reply that I got here in regard to database access - should prove useful to you.
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244


<data-source type="org.apache.commons.dbcp.BasicDataSource" key="userDB">
<set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<set-property property="url" value="jdbc racle:thin:@ rcl" />
<set-property property="username" value="seet" />
<set-property property="password" value="seet" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
<set-property property="validationQuery" value="SELECT COUNT(*) FROM emp" />

Ensure that all jar files related to Oracle and the dbcp datasource are present in the lib folder so that the build.xml has the following entries.

<path id="compile.classpath">
<pathelement path ="lib/struts-legacy.jar"/>
<pathelement path ="lib/commons-dbcp-1.2.1.jar"/>
<pathelement path ="lib/commons-pool-1.3.jar"/>
<pathelement path ="lib/classes12.jar"/>
<pathelement path ="lib/ojdbc14.jar"/>


I agree. Here's the link: http://aspose.com/file-tools
subject: configuring datasource in struts-config.xml
It's not a secret anymore!