How can I use the org.apache.commons.dbcp.PoolingDataSource?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How can I use the org.apache.commons.dbcp.PoolingDataSource?

Latha.Kamatchi
Dear Experts,

I am developing a web application using struts 1.1
I am new to this struts environment.

My app needs connection pooling,
I plan to use org.apache.commons.dbcp.PoolingDataSource.
Does the 'BasicDataSource' not support connection pooling?

I configure the database properties in the struts-config.xml file as

<data-sources>
                <data-source
type="org.apache.commons.dbcp.BasicDataSource">
                        <set-property property="driverClassName"
value="com.jnetdirect.jsql.JSQLDriver" />
                        <set-property property="url"
value="jdbc:JSQLConnect://myserver/mysqldb" />
                        <set-property property="username" value="sa" />
                        <set-property property="password" value="password"
/>
                </data-source>
        </data-sources>

Its working when I use the following in my action class as

BasicDataSource ds = getDataSource(request);


But i now have doubt that when we use 'PoolingDataSource' and how can I
configure it in struts-config.xml file and access it inside the code?

And how can I check that the connection is retrived from the pool instead
its creating newly?

Any help wud be appriciated.

Thanks in advance
Latha