diff --git a/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java b/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java index 31e47f25d..4cba25d96 100644 --- a/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java +++ b/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java @@ -2164,10 +2164,13 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat try { connection = createPhysicalConnection(); setFailContinuous(false); - } catch (SQLException e) { - LOG.error("create connection error, url: " + jdbcUrl + ", errorCode " + e.getErrorCode() - + ", state " + e.getSQLState(), e); - + } catch (SQLException | RuntimeException e) { + if (e instanceof SQLException) { + LOG.error("create connection error, url: " + jdbcUrl + ", errorCode " + ((SQLException)e).getErrorCode() + + ", state " + ((SQLException)e).getSQLState(), e); + } else { + LOG.error("create connection error", e); + } errorCount++; if (errorCount > connectionErrorRetryAttempts && timeBetweenConnectErrorMillis > 0) { // fail over retry attempts @@ -2193,11 +2196,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat DruidDataSource.this.doSomethingBeforeCreationThreadBreak(); break; } - } catch (Exception e) { - LOG.error("create connection error", e); - setFailContinuous(true); - DruidDataSource.this.doSomethingBeforeCreationThreadBreak(); - break; } catch (Error e) { LOG.error("create connection error", e); setFailContinuous(true);