-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
连接失败时调用不返回 #3357
Comments
druid 久经验证,不会有问题的,换个高版本看看或者把初始大小置成0试一下。 |
一样遇到这个问题,初始化失败后,比如数据库用户密码错误的,程序就会一直卡死 |
同样遇到该问题,增加如下配置也无法解决。 |
诸位,添加fast-fail:true就可以了 |
druidDataSource.setFailFast(true); //要通过代码设置,配置文件好像不生效 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我用的spring boot (starter 2.1.5.RELEASE)+mybatis (starter 2.0.1)+druid (starter 1.1.17)+mssqlserver jdbc 7.2.2.jre8+swing, jdk 1.8.212,开发的。
spring boot配置使用的多数据源,使用druid连接池。
在修改配置为错误的ip端口,或错误的数据库名字后,第一次调用mybatis的方法,druid初始化连接,会抛出mssql的sql exception,报连接错误;但是druid会不断尝试重复连接,不会返回。
参考网上的讲解,配置了
connection-error-retry-attempts=0
break-after-acquire-failure=true
后,虽不再重复尝试连接,但mybatis的方法调不会返回,而一直卡在那里了。
对此,网上也有说druid有问题,不如切换hiraki的。
也许这个mssqlserver jdbc 抛出的异常有关?抛出的是普通的sql exception,不过带了错误代码解释了错误的原因。
The text was updated successfully, but these errors were encountered: