baomidou / dynamic-datasource

dynamic datasource for springboot 多数据源 动态数据源 主从分离 读写分离 分布式事务
https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611
Apache License 2.0
4.76k stars 1.2k forks source link

druid testOnBorrow设置为true时,连接sqlserver 抛出异常 #601

Closed Ruichian closed 11 months ago

Ruichian commented 11 months ago

Please fill it out carefully, or it will be closed. 请认真填写,不然会直接关闭。

Enviroment

JDK Version(required): 1.8

SpringBoot Version(required): 2.4.2

dynamic-datasource-spring-boot-starter Version(required):3.5.2

druid Version(optional):1.2.5

Describe what happened

image 当testOnBorrow设置为true时,连接sqlserver 抛出异常 org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException

Expected Result:

Actual Result:

If there is an exception,or aop invalid,please attach the exception trace:

Just paste your stack trace here!

Steps to reproduce

huayanYu commented 11 months ago

所以呢?

Ruichian commented 11 months ago

所以呢?

要用dynamic-datasource-spring-boot-starter Version 就一定要把testOnBorrow设置为false吗

huayanYu commented 11 months ago

我不知道,能不能用是连接池和数据库的事情, 不是我控制能不能用的事.