On Wed, 15 Dec 2004 09:26:19 -0500, Nick Stuart wrote:

>
>Andreas, you should look at the commons DBCP (database connection
>pooling) package. It wraps any JDBC driver to allow for connection
>pooling. Read up on there site for examples.
>http://jakarta.apache.org/commons
>
>Michael, for the advantages, it mainly allows you to share the driver
>connections with anything in your app. Right now you just have it set
>up so that the Castor part of your app will use connection pooling,
>which may be fine and you may not have any regular JDBC stuff in it at
>all. But I personally use castor along with normal SQL calls in my
>app, and would like to set up the conenction for both in one place so
>I dont have to worry about it. Using JNDI allows for this, and has the
>bonus of setting up connection pooling really easily.

On top of what Nick said already, don't forget maintainability (which is often 
overseen in this context). I mean, if you database connection properties 
ever changed during the lifetime of your web application, there's only one 
place to change, and it's part of the server configuration (if you happen to 
use 
server.xml for such <Resource> entries). Iow, you do not have to touch your web 
application for a change in your resource configuration. And this 
could be any resources, not just a JDBC DataSource: JMS queue managers, JMS 
queues, JCA connectors, anything.

>Here's all I do to set up the connection to use in ANY part of my app:
><Resource name="jdbc/MyDatabase" auth="Container" type="javax.sql.DataSource"
>            factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>            maxActive="#"
>            maxIdle="#"
>            maxWait="#"
>            username="myUser"
>            password="myPassword"
>            driverClassName="net.sourceforge.jtds.jdbc.Driver"
>            url="jdbc:jtds:sqlserver://<host>/<database>"/>
>
>Hope this helps some.
>
>
>On Wed, 15 Dec 2004 15:14:19 +0100, Andreas Vombach
><[EMAIL PROTECTED]> wrote:
>> 
>> .. I use Oracle, I'm not sure if the JDBC driver supports pooling.
>> All libraries are in place and unpooled connections work.
>> I'm just trying to find out if it is a tomcat problem by testing a
>> pooled con without castor ...
>> 
>> Cheers Andreas
>> 
>> 
>> -----------------------------------------------------------
>> If you wish to unsubscribe from this mailing, send mail to
>> [EMAIL PROTECTED] with a subject of:
>>         unsubscribe castor-user
>>
>
>
>
>----------------------------------------------------------- 
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>        unsubscribe castor-user
>



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to