struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Tedone" <m_ted...@hotmail.com>
Subject RE: Database datasource runtime configuration
Date Sat, 08 Mar 2003 22:42:47 GMT
You could create an XML configuration file and then parse it with
commons-digester(filling a Java Object with the XML relevant information). I
used this technique creating a class as a Struts PlugIn which parse an XML
configuration file and fill the resource my application needs.

Regards,

Marco

> -----Original Message-----
> From: Joao Araujo [mailto:joao@wireless-networks.com] 
> Sent: Saturday, March 08, 2003 3:52 AM
> To: struts-user@jakarta.apache.org
> Subject: Database datasource runtime configuration
> 
> 
> 
> Hi,
> 
> 
> 	I am using the configuration of the datasource/database 
> inside the 
> struts-config.xml file.
> 	That 's been giving me some backwards. For example I 
> wish to change the 
> hostname
> 	after installing the whole software. I, then, need to 
> open the file and 
> change the configuration
> 	for this.
> 
> 	I wish I could put this in another file and set the 
> configuration at run 
> time. Does anyone know
> 	how to do that?
> 
> 	SAMPLE CONFIGURATION
> 	<data-sources>
> 		<!-- configuration for commons BasicDataSource -->
> 		<data-source 
> type="org.apache.commons.dbcp.BasicDataSource">
> 			<set-property property="driverClassName"
> 							
> value="oracle.jdbc.driver.OracleDriver" />
> 			<set-property property="url"
> 							
> value="jdbc:oracle:thin:@db.db1.com:1521:xxxx"
> 			<set-property property="username" 
> value="system" />
> 			<set-property property="password" 
> value="manager" />
> 			<set-property property="pingQuery" 
> value="select 1 from dual" />
> 			<set-property property="description"
> 				  value="DBTEST Data Source 
> Configuration"/>
> 			<set-property property="maxCount"  value="4"/>
> 			<set-property property="minCount"  value="2"/>
> 			<set-property property="autoCommit"  
> value="false"/>
> 		</data-source>
> 	</data-sources>
> 
> 	Thanks,
> 
> Joao, 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message