struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: Struts2 connection pooling using MySQL
Date Wed, 20 Feb 2008 11:17:18 GMT
Struts1 provided a data-source configuration element because, at the 
time that was added, there was no consistent mechanism for configuring 
data sources that worked across servlet containers. That changed a long 
time ago and Struts first deprecated, and then removed, its support for 
the data-source configuration element.

The preferred way to set up a data source (using a connection pool or 
not) is through JNDI using your servlet container configuration. The 
article Jeromy linked to mentions JNDI and links to more detailed 
documentation for various servlet containers and application servers.

In short:

1) configure a data source (connection pool) and expose it via JNDI, 
using your servlet container or application server as described in the 
documentation linked from that article;

2) modify any code you have that uses a data source (connection pool) to 
obtain it from JNDI, using the code in that article

You don't need Struts2 to be able to do this for you, as there are 
standard mechanisms you can use instead. Of course the prior reference 
to Spring is a good one to look into since Spring provides all sorts of 
help in configuring and using data sources and the database beneath them :-)

L.

RajiR wrote:
> Hi,
> 
> In this link :
> http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html,
> 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
>> http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html
>>
>> Does that help?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message