Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Tomcat JDBC Connection pools get shared between instances?

We have a web application right now that we deploy a copy for each client. Our current deployment strategy is to create a uniquely named jdbc connection pool for each instance. so say jdbc/client. They are specified like this...

< Context path="/"
        reloadable="true"
        docBase="\home\client\ROOT"
        debug="5" >
        < Resource name="jdbc/client"
                auth="Container"
                type="javax.sql.DataSource"
                maxActive="100"
                maxIdle="30"
                validationQuery="SELECT 1"
                testWhileIdle="true"
                timeBetweenEvictionRunsMillis="300000"
                numTestsPerEvictionRun="6"
                minEvictableIdleTimeMillis="1800000"
                maxWait="10000"
                username="user"
                password="pass"
                driverClassName="com.mysql.jdbc.Driver"
                url="jdbc:mysql://databaseserver:3306/client ?zeroDateTimeBehavior=convertToNull&amp;jdbcCompliantTruncation=false"/>
< /Context>

The question is, if I were to standardize it so that instead of unique names the connection pool is called jdbc/database on all deployed instances, is there a chance of database crossing, ie one customer in another customer's database, or are these localized to a specific deployed instance?

Thoughts? Thanks, Scott

like image 728
Scott Bonner Avatar asked Aug 27 '09 15:08

Scott Bonner


1 Answers

No. The scope of the data source name is one Tomcat instance.

If you are starting a separate Tomcat process for each customer, all that matters is how the data source is configured, not what Tomcat calls it. As long as each data source is configured to use a different database, there won't be any cross talk.

like image 122
erickson Avatar answered Sep 29 '22 11:09

erickson