-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ray,
On 4/26/2009 10:00 PM, Raymond Kleijngeld wrote:
> I'm writing an application to support multiple clients using the same
> tomcat application. For security purposes I want each client to have
> there own database schema and subsequently their own subdomain i.e.
> sub1.domain.com, sub2.domain.com etc.
>
> I know I can update the server.xml file and add extra resource tags and
> extra alias tags for each new client but I don't want the tomcat server
> to be restarted because this would interupt the service/application to
> other clients.
The hostnames must be configured in server.xml. See André's post for
more information on that.
You can configure your database resources in your webapp's
META-INF/context.xml file. Something like this:
<Context>
<Resource name="jdbc/MyDataSource"
description="My JDBC connection"
auth="Container"
type="javax.sql.DataSource"
maxActive="1"
maxIdle="1"
maxWait="10000"
url="jdbc:mysql://localhost:3306/mydatabase"
username="scott"
password="tiger"
driverClassName="com.mysql.jdbc.Driver"
removeAbandoned="true"
removeAbandonedTimeout="30"
logAbandoned="true"
testOnBorrow="true"
validationQuery="SELECT 1"
/>
</Context>
When these resources are configured within the webapp, re-deploying the
webapp is enough to update the configuration. There appears to be a bug
in Tomcat where application-defined DataSources are not shut down when
the application is undeployed. I suspect a re-deploy will replace the
configuration, but if you find that you are running out of db
connections on the server-side, you may want to look into this as a
possibility.
Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkn1yY0ACgkQ9CaO5/Lv0PDu9QCfVepWutXbMttUvzBvoiYNACDy
wCoAn0i5iMQchRykPzUcsqiZfSwg81fg
=TMgr
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]