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

Database can not be null #61

Open
281743556 opened this issue Jan 7, 2022 · 4 comments
Open

Database can not be null #61

281743556 opened this issue Jan 7, 2022 · 4 comments

Comments

@281743556
Copy link

因为业务需要,会基于参数变更connection的catalog。
默认不设置catalog,连接如下:
127.0.0.1:3306/?useUnicode=true&useSSL=false
在设置catalog后,beecp执行完SQL,关闭connection时,通过recycleSelf调用resetRawConn按照defCatalog进行复位。上述情况,在复位时,会抛出异常:java.sql.SQLException: Database can not be null
产生如下问题:
1、出于什么考虑,再会connection关闭后进行复位?
2、是否可以关闭该复位?

@Chris2018998
Copy link
Owner

这个异常是由Mysql驱动报的
1 :复位主要是避免Connection的上脏属性带给下一个使用使用者
2:这个问题的最佳的解决办法就是设置一个默认的catalog

@Chris2018998
Copy link
Owner

去掉了catalog的复位的版本

https://github.com/Chris2018998/BeeCP/blob/master/doc/release/custom/beecp-3.3.1_No_catlog.jar

如果有什么问题,可以再提出。

@Chris2018998
Copy link
Owner

新版的catlog,schema的默认值是空的,将会从第一个连接上读取值并视作默认值,在这种情形下,如果这两个默认值还是空,那么就没有复位操作了。

新版还在测试中,过段时间会发布,

@Chris2018998
Copy link
Owner

数据源配置有一个catlog的是否启用的开关,默认是支持,如果你不想支持,设置该变量为false即可,看下图

图片

@Chris2018998 Chris2018998 reopened this Jan 9, 2024
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

2 participants