适用于不同架构的Tomcat JDBC连接池 [英] Tomcat JDBC connection pool for different schema

查看:196
本文介绍了适用于不同架构的Tomcat JDBC连接池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用tomcat jdbc为同一数据库配置2个不同的模式. 我们是否需要为不同的架构创建两个不同的tomcat jdbc池连接配置,还是可以配置一个jdbc连接池,然后使用该连接池连接到两个不同的架构.

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.

推荐答案

这取决于

如果两个模式共享相同的凭据并托管在同一数据库服务器上,则可能使用 one 池.但是随后您必须在所有查询中都包含架构,例如:

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.

这篇关于适用于不同架构的Tomcat JDBC连接池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆