struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <>
Subject Re: Struts2 connection pooling using MySQL
Date Wed, 20 Feb 2008 11:13:55 GMT
Right.  The configuration file the mysql reference refers to is the 
Container configuration, for example, server.xml or context.xml provided 
with Tomcat.  Every J2EE container provides that configuration.  Struts 
1 provides some config to simply it, but Struts 2 doesn't provide 
convenience config like that.

Setup your DataSource for the Container, then reference it in web.xml.  

The only issue for Struts2 users is how you access the DataSource within 
your actions or services. If you use Spring it's easy via DI.  If you 
Guice it's also easy via DI.  If you don't use a DI container you can 
look-up the DataSource every time you need it, or place the instance in 
your Application Context, as you'd do with a servlet.

Hope that helps.

RajiR wrote:
> Hi,
> In this link :
> we can preform connection pooling only after configuring it in our
> configuration files.If it is in the case of struts1, struts-config.xml file
> has a tag called <data-source/> and there we can configure.But,what about
> struts2 how can we configure in its configuration file(struts.xml)?I think
> only after configuring in the configuration file(for eg., struts.xml  in the
> case of struts2),we can use the connection pool using a java program as it
> is explained in the link provided by you.So the problem is with how to
> configure the pool in the struts.xml?I think I am clear...!!
> Thanks.
> Jeromy Evans - Blue Sky Minds wrote:
>> RajiR wrote:
>>> Can't we implement connection pooling in struts2 alone?If so ,may I know
>>> the
>>> reason please...!!!
>>> Thanks.
>> Struts 2 itself doesn't provide a connection pooling implementation and 
>> probably shouldn't.
>> MySql provide a pooled DataSource that you can use immediately.  Set it 
>> up the same way as your current DataSource
>> Does that help?
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message