Support all DBCP parameters in JDBCDataStoreFactory
---------------------------------------------------

                 Key: GEOT-2558
                 URL: http://jira.codehaus.org/browse/GEOT-2558
             Project: GeoTools
          Issue Type: Improvement
          Components: data jdbc-ng
    Affects Versions: 2.6-M2
            Reporter: Ben Caradoc-Davies
            Priority: Minor


Consider supporting all DBCP parameters in JDBCDataStoreFactory. Currently only 
validation and max connections are supported.
http://commons.apache.org/dbcp/configuration.html

DBCP idle-connection management parameters can be very useful for preventing 
and recovering from connection loss when there is a firewall or broken network 
between the application and the database, or the database server is unreliable. 
At the moment, the workaround is to use JNDI to configure the connection pool. 
This may not be possible in some use cases. In particular, GeoTools may be used 
where it is not hosted in a EE container, and JNDI support may not be present. 
Even in GeoServer, some users may not be able to modify their tomcat 
configuration due to local policy.

Consider renaming some parameters, perhaps even retaining the DBCP form. 
However, neither "timeBetweenEvictionRunsMillis" nor
"time between eviction run millis" are going to win you many friends.  :-/

>From discussion on geoserver-users list:

Subject: Re: [Geoserver-users] [ExternalEmail] Re: Not reconnecting to  
database?
Date: Fri, 19 Jun 2009 10:58:22 +0800
From: Ben Caradoc-Davies 
To: Andrea Aime
CC: Geoserver-users

Ben Caradoc-Davies wrote:
> Andrea Aime wrote:
>> Yep, a JNDI pool will give you access to all of the DBCP options.
> I have found GEOT-2509 (thanks Christian) and
> http://docs.geoserver.org/1.7.x/user/tutorials/tomcat-jndi/tomcat-jndi.html
> (thanks Andrea).
>> So try that out and let me know, if this turns out to be a winner
>> I'll add those options to JDBCDataStore as well
> OK, I will let you know.

Christian, thanks for your work on the JNDI data store factories. The 
Oracle one seems to work very well.

Andrea, I was able to fix all my lost connection problems using a JNDI 
connection pool configured to close idle connections after 5-10 minutes, 
before they can be dropped by the firewall. It might be rather useful to 
support all DBCP parameters in JDBCDataStore, for those who cannot or do 
not wish to use JNDI. I will submit a GeoTools ticket.

I used a Resource like the one below in my Context in tomcat server.xml 
(I am not using auto-deployment). I also added a resource section to my 
WEB-INF/web.xml as described in your tutorial page. The one nasty detail 
is that I had to use the fully-qualified JNDI reference name when 
setting my app-schema connection parameters (not just "jdbc/oracle"):

<Parameter>
<name>jndiReferenceName</name>
<value>java:comp/env/jdbc/oracle</value>
</Parameter>

Here is the context (expurgated):

<Context
     path="/whatever"
     docBase="/usr/local/whatever/geoserver"
     crossContext="false"
     debug="0"
     reloadable="false">
     <Resource
         name="jdbc/oracle"
         auth="Container"
         type="javax.sql.DataSource"
         url="jdbc:oracle:thin:@oracle.example.com:1521:db"
         driverClassName="oracle.jdbc.driver.OracleDriver"
         username="whatever_username"
         password="whatever_password"
         maxActive="20"
         maxIdle="10"
         minIdle="0"
         maxWait="10000"
         minEvictableIdleTimeMillis="300000"
         timeBetweenEvictionRunsMillis="300000"
         numTestsPerEvictionRun="20"
         poolPreparedStatements="true"
         maxOpenPreparedStatements="100"
         testOnBorrow="true"
         validationQuery="SELECT SYSDATE FROM DUAL" />
</Context>

Thanks again for all your help troubleshooting this rather nasty problem.

Kind regards,

-- 
Ben Caradoc-Davies 
Software Engineer, CSIRO Exploration and Mining
Australian Resources Research Centre
26 Dick Perry Ave, Kensington WA 6151, Australia


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to