[jboss-user] [Javassist user questions] - How To use Connection Pooling in Struts.

ashish.mishra16 do-not-reply at jboss.com
Mon Feb 26 23:15:04 EST 2007


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



More information about the jboss-user mailing list