Unable to obtain second data source defined in the struts config xml.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, March 17, 2003 11:53 PM

I have two data sources defined in my struts config xml, one default and one with a key - LIBW. I am able to obtain the default data source using the default Action.DATA_SOURCE_KEY but I am unable to get the second data source using the key I defined as a property in the struts config. Struts Config: value="false"/> value="default read only data source"/> value="oracle.jdbc.driver.OracleDriver"/> value="4"/> value="2"/> value="password"/> value="jdbc:oracle:oci8   More>>

I have two data sources defined in my struts config xml, one default and one with a key - LIBW.

I am able to obtain the default data source using the default Action.DATA_SOURCE_KEY but I am unable to get the second data source using the key I defined as a property in the struts config.

Struts Config:

			







value="false"/>



value="default read only data source"/>



value="oracle.jdbc.driver.OracleDriver"/>



value="4"/>



value="2"/>



value="password"/>



value="jdbc:oracle:oci8:@xxxx"/>



value="username"/>



value="true"/>







value="LIBW"/>



value="false"/>



value="write data source"/>



value="oracle.jdbc.driver.OracleDriver"/>



value="4"/>



value="2"/>



value="password"/>



value="jdbc:oracle:oci8:@xxxx"/>



value="username"/>






Action Class Code:

			

javax.sql.DataSource dataSource;

dataSource =

(DataSource)(servlet.getServletContex()).getAttribute("LIBW");

if( dataSource != null ){

log( "got ds" );

}else{

log( "no ds" );

}

What do I have set up wrong? Is getting the datasource by using getAttribute on the servlet context correct? It is odd that I can obtain the default using getAttribute, but unable to get the second one using the key I specified for it.

Thankx

   <<Less

Re: Unable to obtain second data source defined in the struts config xml.

Posted By:   Vaishali_Desai  
Posted On:   Wednesday, March 26, 2003 07:46 AM

You have to declare the key within the tag.
eg:
About | Sitemap | Contact