Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setSchema方法未实现 #3865

Closed
liresky opened this issue Jul 8, 2020 · 3 comments
Closed

setSchema方法未实现 #3865

liresky opened this issue Jul 8, 2020 · 3 comments
Milestone

Comments

@liresky
Copy link

liresky commented Jul 8, 2020

DruidPooledConnection未实现setSchema方法,这样无法在实际运行环境中实现切库操作。

@KANLON
Copy link
Contributor

KANLON commented Jul 11, 2020

我是通过 自己执行 update SQL 来实现,“use test_db1” 这样,其实这样还好

@liresky
Copy link
Author

liresky commented Jul 11, 2020

我是通过 自己执行 update SQL 来实现,“use test_db1” 这样,其实这样还好
我提这个是因为要做一服多库的多租户。

  1. 多个请求不在一个session里,几乎所有地方都要动,还有判断。
  2. 执行sql和setSchema的有性能差距。
  3. 如果把use test_db1作为当做Mybatis插件,那么不同的数据库就要执行不同的SQL,这个插件的通用性就很差了。
    所以你说的还好,我不太理解这样做的好处有什么?

@wenshao
Copy link
Member

wenshao commented Oct 5, 2020

use test_db1和setSchema的性能是一致的,都需要服务端通讯实现。同时mysql driver在没有额外配置时,setSchema是不起作用的。

@wenshao wenshao closed this as completed in 0f2e36c Oct 5, 2020
@wenshao wenshao added this to the 1.2.0 milestone Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants