Open yzt7805882 opened 4 years ago
druid 1.1.6对应springboot 1.7.9版本 当数据库ip错误 是可以进入catch druid 1.1.10对应springboot 2.1.3版本 当数据库ip错误 在控制台报错java.sql.SQLException: The Network Adapter could not establish the connection 不断重复报错,然而永远不会进入catch模块 代码如下
try{ DynamicDataSourceContextHolder.set(DataSourceKey.DB_MASTER); List<TXxfbTzggxx> queryData = new ArrayList(); queryData = tXxfbTzggxxMapper.selectInfoTitle(); } catch(Exception e){ DynamicDataSourceContextHolder.set(DataSourceKey.DB_OTHER); }
我用druid做多数据源切换,在1.1.6版本当数据库连接失败,会进入catch,可以在catch块切换数据源,然而1.1.10版本以后都不会进入catch,1.1.20也试过 不行,请问是哪里出了问题
druid 1.1.6对应springboot 1.7.9版本 当数据库ip错误 是可以进入catch druid 1.1.10对应springboot 2.1.3版本 当数据库ip错误 在控制台报错java.sql.SQLException: The Network Adapter could not establish the connection 不断重复报错,然而永远不会进入catch模块 代码如下