You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aurelien Pernoud <au...@givaudan.com> on 2015/09/16 10:59:34 UTC

JNDI Datasource override default settings for ALL resources in a central XML ?

Hello,

In our Tomcat (7 or 8 doesn't matter) servers we always override many
parameters among datasources, in each application context file (we deploy
one context file / application under conf/Catalina/localhost).

Every time I have to set :
- maxActive
- maxIdle
- validationQuery (we mostly work with oracle...)
then depending on tomcat 7 or 8 we override as well the parameters for
logabandoned, removeabandoned... and many others.

But we in fact always or almost set the same values for all of them.

The issue is that when we want to change on of those parameters (for ex
decide that now for our DataSource the maxActive should be 20 instead of 10
let's say), we have to update all our XML

I was wondering if there was a way to change the default parameters in a
centralized place, this way in each of our context file we would only need
to set :

name="jdbc/xxx"
username="user"
password="password"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbcurl"

and the rest would be OUR default settings, not the one from tomcat default
:-)

I didn't find any documentation/discussion on this requirement, but I'm
sure we are not alone ?

Best regards,
Aurelien Pernoud

Re: JNDI Datasource override default settings for ALL resources in a central XML ?

Posted by Aurelien Pernoud <au...@givaudan.com>.
Hello Mark,

Thanks for the quick reply, we will definitely try this !

Aurelien

Re: JNDI Datasource override default settings for ALL resources in a central XML ?

Posted by Mark Thomas <ma...@apache.org>.
On 16/09/2015 09:59, Aurelien Pernoud wrote:
> Hello,
> 
> In our Tomcat (7 or 8 doesn't matter) servers we always override many
> parameters among datasources, in each application context file (we deploy
> one context file / application under conf/Catalina/localhost).
> 
> Every time I have to set :
> - maxActive
> - maxIdle
> - validationQuery (we mostly work with oracle...)
> then depending on tomcat 7 or 8 we override as well the parameters for
> logabandoned, removeabandoned... and many others.
> 
> But we in fact always or almost set the same values for all of them.
> 
> The issue is that when we want to change on of those parameters (for ex
> decide that now for our DataSource the maxActive should be 20 instead of 10
> let's say), we have to update all our XML
> 
> I was wondering if there was a way to change the default parameters in a
> centralized place, this way in each of our context file we would only need
> to set :
> 
> name="jdbc/xxx"
> username="user"
> password="password"
> driverClassName="oracle.jdbc.OracleDriver"
> url="jdbcurl"
> 
> and the rest would be OUR default settings, not the one from tomcat default
> :-)
> 
> I didn't find any documentation/discussion on this requirement, but I'm
> sure we are not alone ?

The defaults are set by Commons DBCP.

What you can do is use ${...} property replacement for you defaults and
specify the values to use in catalina.properties. That way, changing a
default is a single change to the property file (and a restart).

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org