mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
if config incorrect, log error
This commit is contained in:
@@ -274,6 +274,12 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
if (this.driverClass != null) {
|
||||
this.driverClass = driverClass.trim();
|
||||
}
|
||||
|
||||
if (isTestOnBorrow() || isTestOnReturn() || isTestWhileIdle()) {
|
||||
if (this.getValidationQuery() == null || this.getValidationQuery().length() == 0) {
|
||||
LOG.error("validationQuery not set");
|
||||
}
|
||||
}
|
||||
|
||||
if (this.jdbcUrl != null) {
|
||||
this.jdbcUrl = this.jdbcUrl.trim();
|
||||
@@ -281,6 +287,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
if (jdbcUrl.startsWith(DruidDriver.DEFAULT_PREFIX)) {
|
||||
DataSourceProxyConfig config = DruidDriver.parseConfig(jdbcUrl, null);
|
||||
this.driverClass = config.getRawDriverClassName();
|
||||
|
||||
LOG.error("error url : " + jdbcUrl + ", it should be : " + config.getRawUrl());
|
||||
|
||||
this.jdbcUrl = config.getRawUrl();
|
||||
if (this.name == null) {
|
||||
this.name = config.getName();
|
||||
@@ -343,6 +352,12 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
} else if (realDriverClassName.equals("com.alibaba.druid.mock.MockDriver")) {
|
||||
this.exceptionSorter = new MockExceptionSorter();
|
||||
}
|
||||
|
||||
if (realDriverClassName.equals("com.mysql.jdbc.Driver")) {
|
||||
if (this.isPoolPreparedStatements()) {
|
||||
LOG.error("mysql should not use 'PoolPreparedStatements'");
|
||||
}
|
||||
}
|
||||
|
||||
dataSourceStat = new JdbcDataSourceStat(this.name, this.jdbcUrl, this.dbType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user