aspose file tools*
The moose likes Struts and the fly likes value of DATA_SOURCE_KEY field in Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "value of DATA_SOURCE_KEY field in Action class" Watch "value of DATA_SOURCE_KEY field in Action class" New topic
Author

value of DATA_SOURCE_KEY field in Action class

siva prakash
Ranch Hand

Joined: Aug 24, 2004
Posts: 80
Hi all,

if I define more than one datasource in struts-config.xml without specifying key attribute, which value will be stored in Action.DATA_SOURCE_KEY field.

example :

<data-sources>
<data-source
autoCommit="false"
description="First Database Config"
driverClass=" org.gjt.mm.mysql.Driver"
maxCount="4"
minCount="2"
password="admin"
url="jdbc:mysql://localhost/ARTICLEDB"
user="admin"
/>
<data-source
autoCommit="false"
description="Second Database Config"
driverClass="oracle.jdbc.driver.OracleDriver"
maxCount="4"
minCount="2"
password="admin"
url="jdbc racle:thin:@localhost:1521/AUTHORDB"
user="admin"
/>
</data-sources>



Thanks,
Prakash
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Any time there is a duplicate definition in the struts-config.xml file, the second definition is the one that will be used.

Note: Support for the Struts DataSource utility has been removed from the latest version of Struts (1.3.5). If you want your application to be upgradeable to the latest version, you may want to consider defining the DataSource as a JNDI resource in your application server instead of with the Struts utility.


Merrill
Consultant, Sima Solutions
 
jQuery in Action, 2nd edition
 
subject: value of DATA_SOURCE_KEY field in Action class