I m using commons pool, and DBCP.,
Currently in a Class which implements Plugin interface, i m writing following 
code, 

GenericObjectPool pool = new GenericObjectPool(null); //
pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
                                                        
DataSource datasource = actionServlet.findDataSource("msgds");
Connection con=datasource.getConnection();
PoolableConnection pc=new PoolableConnection(con, pool);
context.setAttribute("con", pc);


In all each Action, i m using this PoolableConnection as follows:

PoolableConnection con  =  (PoolableConnection) context.getAttribute("con");
Statement st  =  con.createStatement();                 


I just want to know is this method is corrtect n efficient. I had defined 
datasource in struts-config.xml like this: 

<data-source type="org.apache.commons.dbcp.BasicDataSource" key="msgds">

<set-property property="description" value="OracleXE Data Source" />
<set-property property="driverClassName" 
value="oracle.jdbc.driver.OracleDriver" />

<set-property property="url" value="jdbc:oracle:thin:@192.168.1.8:1521" />

<set-property property="minCount" value="2" />
<set-property property="maxCount" value="50" />
<set-property property="maxWait" value="5000" />
<set-property property="username" value="ashish" />
<set-property property="password" value="ashish" />
<set-property property="autoCommit" value="true" />
<set-property property="readOnly" value="false" />              

</data-source>

Please help me how to use commons pool and DBCP for connection pooling.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022833#4022833

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4022833
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to