You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Carsten Pohl <po...@tyntec.com> on 2009/11/02 18:05:47 UTC

how to change the url,username and password connection pooling

Hi,

I wrote a webapp, that is using tomcats connection pooling. I was wondering how I can change URL / username or password of the connection pool, without redeploying the webapp.

I tried the following:

1. putting the configuration in the $CATALINA_BASE/conf/[enginename]/[hostname]/[webappname].xml and then changing the ressource entries. This works (in 6.0.18) but a redeploy happens. Which means, that the application is unavailable for some time.

2. Using JMX to connect to the tomcat. Under catalina -> datasource -> webappname -> localhost-> javax.sql.datasource -> "jdbc/postgres" -> attributes  i see the URL, but when i change that, nothing happens.

What possiblities are left? Or is there simply no way to change that, while the application runs?

Thank you in advance,
Regards,
Carsten Pohl

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


Re: how to change the url,username and password connection pooling

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Carsten,

On 11/2/2009 12:05 PM, Carsten Pohl wrote:
> I wrote a webapp, that is using tomcats connection pooling. I was
> wondering how I can change URL / username or password of the
> connection pool, without redeploying the webapp.
> 
> I tried the following:
> 
> 1. putting the configuration in the
> $CATALINA_BASE/conf/[enginename]/[hostname]/[webappname].xml and then
> changing the ressource entries. This works (in 6.0.18) but a redeploy
> happens. Which means, that the application is unavailable for some
> time.

This is expected behavior.

> 2. Using JMX to connect to the tomcat. Under catalina -> datasource
> -> webappname -> localhost-> javax.sql.datasource -> "jdbc/postgres"
> -> attributes  i see the URL, but when i change that, nothing
> happens.

You are only changing the "configuration", you aren't changing the
DataSource that was created using that configuration. If you want to
switch-out the DataSource in the JNDI context during runtime, you'll
have to actually create a new instance of a DataSource and stuff it into
the JNDI context. I'm not sure if Tomcat will let you do that, though.

Perhaps there is a way, using JMX, to trigger a re-load of the
DataSource configuration so that your above change actually has an
effect. I'm sorry, I don't have any experience with JMX in Tomcat (nor
anywhere else for that matter) so I can't really advise you.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksZivAACgkQ9CaO5/Lv0PA4YQCfQwdR+U/bz/FVBYfw/Dtdaek3
lQwAn0b/bQcm2GmGS4zUXOAzX4GjBaGQ
=dtku
-----END PGP SIGNATURE-----

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