struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <ml...@officinedigitali.it>
Subject Re: Using dbpc package in struts 1.0
Date Wed, 12 Mar 2003 10:31:11 GMT
It use the BasicDataSource rather than the older deprecated struts 
GenericDataSource its more a case of the xml sytaax changing the 
config.xml


	<data-source type="org.apache.commons.dbcp.BasicDataSource" 
key="strutsConnection">
			<set-property property="defaultAutoCommit" value="false"/>
			<set-property property="driverClassName" 
value="com.mysql.jdbc.Driver"/>
			<set-property property="url" value="jdbc:mysql://etc"/>
			<set-property property="maxActive" value="4"/>
			<set-property property="username" value="arse"/>
			<set-property property="password" value="bandit"/>
			<set-property property="maxWait" value="5000"/>
	</data-source>

To do this in java rather than the ds being addedas on object in the 
action servlet context .. This example does the same as the xml

BasicDataSource dataSource = new BasicDataSource();
	
dataSource.setDefaultAutoCommit(false);
dataSource.setUsername("arse");
dataSource.setPassword("bandit");
dataSource.setDriverClassName ("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://etc");
dataSource.setMaxActive(2);

				
context.setAttribute("myNewDataSource",dataSource);


hope this helps mark


Mercoledì, 12 mar 2003, alle 11:23 Europe/Rome, Gemes Tibor ha scritto:

> Philippe Van Der Gucht wrote:
>
>> Hello,
>>
>> I would like to use the dbpc package 
>> (http://jakarta.apache.org/commons/dbcp/index.html) in our struts 1.0 
>> application.
>>
>> Has somebody here already done this?
>> If so, what are the issues involved?
>
> Struts 1.0 has a db connection pool implementation included as well. 
> Why
> don't you use it?
>
> Tib
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
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