Tomcat JDBC connection pool for different schema

2019-09-10 00:29发布

问题:

How do we configure 2 different schema for the same database using tomcat jdbc. Do we need to create two different configuration of tomcat jdbc pool connection for different schema or is it possible to configure a single jdbc connection pool then use this connection pool to connect to two different schema.

回答1:

That depends

If your two schema share the same credentials and are hosted on the same db server, you could probably use one pool. But then you'd have to include schema in all your queries like:

  SELECT * FROM mysql.users

If on the other hand you connect with different users or plan to move one of the schema to another server, you by all means want different pools for connections to the different databases.

The save way would be to have multiple pools and use them according to the data you need to access.