This commit is contained in:
温少
2012-03-20 06:23:08 +08:00
parent aaa2e474a5
commit b7be5a659d
4 changed files with 20 additions and 10 deletions
@@ -493,6 +493,10 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
public void addConnectionProperty(String name, String value) {
if (inited) {
@@ -291,8 +291,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
}
}
this.dbType = JdbcUtils.getDbType(jdbcUrl, driverClass.getClass().getName());
if (this.dbType == null || this.dbType.length() == 0) {
this.dbType = JdbcUtils.getDbType(jdbcUrl, driverClass.getClass().getName());
}
if ("oracle".equals(this.dbType)) {
isOracle = true;
@@ -40,30 +40,28 @@ public class WallFilter extends FilterAdapter implements WallFilterMBean {
public void init(DataSourceProxy dataSource) {
this.dataSource = dataSource;
String dbType = this.dbType;
if (this.dbType == null || this.dbType.trim().length() == 0) {
this.dbType = dataSource.getDbType();
}
if (JdbcUtils.MYSQL.equals(dbType)) {
provider = new MySqlWallProvider(config);
if (config == null) {
config = new WallConfig(MySqlWallProvider.DEFAULT_CONFIG_DIR);
}
provider = new MySqlWallProvider(config);
} else if (JdbcUtils.ORACLE.equals(dbType)) {
provider = new OracleWallProvider(config);
if (config == null) {
config = new WallConfig(OracleWallProvider.DEFAULT_CONFIG_DIR);
}
provider = new OracleWallProvider(config);
} else if (JdbcUtils.SQL_SERVER.equals(dbType)) {
provider = new SQLServerProvider(config);
if (config == null) {
config = new WallConfig(SQLServerProvider.DEFAULT_CONFIG_DIR);
}
provider = new SQLServerProvider(config);
} else {
throw new IllegalStateException("dbType not support : " + dbType);
}