You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Purcell <sp...@vertisinc.com> on 2005/01/21 21:41:44 UTC
Database Pooling
Hello,
I am just getting underway with Struts, but have done quite a bit of homework before submitting this query.
Before starting with struts, I configured my Tomcat server to handle DBCP through the server.xml for a web-app I configured. But now with struts, I notice that there is a <data-sources> element that must be filled in.
So according to the docs, for basic (not pooled)
<data-sources>
<!-- configuration for commons BasicDataSource -->
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property
property="driverClassName"
value="org.postgresql.Driver" />
<set-property
property="url"
value="jdbc:postgresql://localhost/mydatabase" />
<set-property
property="username"
value="me" />
<set-property
property="password"
value="test" />
<set-property
property="maxActive"
value="10" />
<set-property
property="maxWait"
value="5000" />
<set-property
property="defaultAutoCommit"
value="false" />
<set-property
property="defaultReadOnly"
value="false" />
<set-property
property="validationQuery"
value="SELECT COUNT(*) FROM market" />
</data-source>
</data-sources>
But my question of course, is I need the database pooling capability. How do I configure that and access connections? I have googled, but I am getting quite a bit of subjective matter back.
Could someone please lend a hand?
Thanks,
Scott K Purcell | Developer | VERTIS |
555 Washington Ave. 4th Floor | St. Louis, MO 63101 |
314.588.0720 Ext:1320 | spurcell@vertisinc.com | http://www.vertisinc.com <http://www.vertisinc.com/>
Vertis is the premier provider of targeted advertising, media, and
marketing services that drive consumers to marketers more effectively.
Re: Database Pooling
Posted by Craig McClanahan <cr...@gmail.com>.
Struts support for the <data-sources> element (which, by the way, is
pooled) is deprecated -- the recommended practice is to use your
container's ability to configure a JNDI based data source, and then
access it using standard JNDI APIs. Examples of that (which are
portable to all JNDI based servers) can be found in the Tomcat docs
at:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
Scroll down to the section on "JDBC Data Sources"
Craig
On Fri, 21 Jan 2005 14:41:44 -0600, Scott Purcell
<sp...@vertisinc.com> wrote:
> Hello,
>
> I am just getting underway with Struts, but have done quite a bit of homework before submitting this query.
>
> Before starting with struts, I configured my Tomcat server to handle DBCP through the server.xml for a web-app I configured. But now with struts, I notice that there is a <data-sources> element that must be filled in.
> So according to the docs, for basic (not pooled)
> <data-sources>
> <!-- configuration for commons BasicDataSource -->
> <data-source type="org.apache.commons.dbcp.BasicDataSource">
> <set-property
> property="driverClassName"
> value="org.postgresql.Driver" />
> <set-property
> property="url"
> value="jdbc:postgresql://localhost/mydatabase" />
> <set-property
> property="username"
> value="me" />
> <set-property
> property="password"
> value="test" />
> <set-property
> property="maxActive"
> value="10" />
> <set-property
> property="maxWait"
> value="5000" />
> <set-property
> property="defaultAutoCommit"
> value="false" />
> <set-property
> property="defaultReadOnly"
> value="false" />
> <set-property
> property="validationQuery"
> value="SELECT COUNT(*) FROM market" />
> </data-source>
> </data-sources>
>
> But my question of course, is I need the database pooling capability. How do I configure that and access connections? I have googled, but I am getting quite a bit of subjective matter back.
>
> Could someone please lend a hand?
>
> Thanks,
>
> Scott K Purcell | Developer | VERTIS |
> 555 Washington Ave. 4th Floor | St. Louis, MO 63101 |
> 314.588.0720 Ext:1320 | spurcell@vertisinc.com | http://www.vertisinc.com <http://www.vertisinc.com/>
>
> Vertis is the premier provider of targeted advertising, media, and
> marketing services that drive consumers to marketers more effectively.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Database Pooling
Posted by Vic <vi...@friendvu.com>.
Use your container for data source(Tomcat) The data source element in
sturts should not be used.
Can you point out where in docs or on Struts page it says to use
<data-source so that it can be fixed?
.V
Scott Purcell wrote:
>Hello,
>
>I am just getting underway with Struts, but have done quite a bit of homework before submitting this query.
>
>Before starting with struts, I configured my Tomcat server to handle DBCP through the server.xml for a web-app I configured. But now with struts, I notice that there is a <data-sources> element that must be filled in.
>So according to the docs, for basic (not pooled)
><data-sources>
><!-- configuration for commons BasicDataSource -->
> <data-source type="org.apache.commons.dbcp.BasicDataSource">
> <set-property
> property="driverClassName"
> value="org.postgresql.Driver" />
> <set-property
> property="url"
> value="jdbc:postgresql://localhost/mydatabase" />
> <set-property
> property="username"
> value="me" />
> <set-property
> property="password"
> value="test" />
> <set-property
> property="maxActive"
> value="10" />
> <set-property
> property="maxWait"
> value="5000" />
> <set-property
> property="defaultAutoCommit"
> value="false" />
> <set-property
> property="defaultReadOnly"
> value="false" />
> <set-property
> property="validationQuery"
> value="SELECT COUNT(*) FROM market" />
> </data-source>
> </data-sources>
>
>
>But my question of course, is I need the database pooling capability. How do I configure that and access connections? I have googled, but I am getting quite a bit of subjective matter back.
>
>Could someone please lend a hand?
>
>Thanks,
>
>
>Scott K Purcell | Developer | VERTIS |
>555 Washington Ave. 4th Floor | St. Louis, MO 63101 |
>314.588.0720 Ext:1320 | spurcell@vertisinc.com | http://www.vertisinc.com <http://www.vertisinc.com/>
>
>Vertis is the premier provider of targeted advertising, media, and
>marketing services that drive consumers to marketers more effectively.
>
>
>
>
>
>
--
RiA-SoA w/JDNC <http://www.SandraSF.com> forums
- help develop a community
My blog <http://www.sandrasf.com/adminBlog>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org