if config incorrect, log error

This commit is contained in:
wenshao
2012-08-07 07:34:49 +08:00
parent 1953b0069a
commit 94e8ce55ec
@@ -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);