You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by amit fulambarkar <am...@gmail.com> on 2006/09/07 09:18:25 UTC
about struts.
How can i implement connection pooling in struts. What will be the
server.xml? and what the things i would have to do.Give the code.
Re: about struts.
Posted by Manfred Wolff <wo...@manfred-wolff.de>.
Hi.
That's a little bit OT. The connection pool should be part of the tomcat
configuration (or an other servlet engine). The server.xml may be a good
part, better you place a xml into the
$CATALINA_HOME/conf/Catalina/localhost folder such as:
<Context path="/example"
docBase="/workspaces/struts-it/examples/src/webapp"
reloadable="true"
crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="examples_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/default"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="application"
password=""
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test?autoReconnect=true"/>
</Context>
Then you are able to configure a connectionpool via jndi ressource. For
more details contact the tomcat documentation.
Manfred
Struts goes mobile. See http://www.strutsme.org
amit fulambarkar wrote:
> How can i implement connection pooling in struts. What will be the
> server.xml? and what the things i would have to do.Give the code.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: about struts.
Posted by Jerome Gagner <ph...@gmail.com>.
WoW.
On 9/6/06, amit fulambarkar <am...@gmail.com> wrote:
> How can i implement connection pooling in struts. What will be the
> server.xml? and what the things i would have to do.Give the code.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: about struts.
Posted by "RoseIndia.net Help" <te...@roseindia.net>.
Hi,
You can use apache DBCP for connection pooling. Apache DBCP is free and
robust connection pooling software.
Have a look at
http://www.roseindia.net/struts/strutsdatasourcemanagerontomcat5.shtml.
Tutorial shows you how to use DBCP with tomcat for your struts applications.
Regards
Deepak Kumar
-----Original Message-----
From: amit fulambarkar [mailto:amit.fulambarkar@gmail.com]
Sent: Thursday, September 07, 2006 12:48 PM
To: struts-user@jakarta.apache.org
Subject: about struts.
How can i implement connection pooling in struts. What will be the
server.xml? and what the things i would have to do.Give the code.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: about struts.
Posted by Gaurav Jain <ga...@infobeans.com>.
Add following code in server.xml to create a JNDI under context tag:-
Here is the JNDI created for oracle DB
<Resource name="jdbc/XYZ" auth="SERVLET"
type="oracle.jdbc.pool.OracleConnectionCacheImpl"/>
<ResourceParams name="jdbc/XYZ">
<parameter>
<name>factory</name>
<value>org.apache.naming.factory.BeanFactory</value>
</parameter>
<parameter>
<name>driverType</name>
<value>thin</value>
</parameter>
<parameter>
<name>serverName</name>
<value>0.0.0.0</value>
</parameter>
<parameter>
<name>networkProtocol</name>
<value>tcp</value>
</parameter>
<parameter>
<name>databaseName</name>
<value>xyz</value>
</parameter>
<parameter>
<name>portNumber</name>
<value>1521</value>
</parameter>
<parameter>
<name>user</name>
<value>xyz</value>
</parameter>
<parameter>
<name>password</name>
<value>a</value>
</parameter>
<parameter>
<name>maxLimit</name>
<value>5</value>
</parameter>
</ResourceParams>
Write the following code in web.xml of your application
<!-- Example of datasources setup -->
<resource-ref>
<description>Oracle DataSource</description>
<res-ref-name>jdbc/XYZ</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
After that make the connection in action classes using this JNDI.
-----Original Message-----
From: amit fulambarkar [mailto:amit.fulambarkar@gmail.com]
Sent: Thursday, September 07, 2006 12:48 PM
To: struts-user@jakarta.apache.org
Subject: about struts.
How can i implement connection pooling in struts. What will be the
server.xml? and what the things i would have to do.Give the code.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org