mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
optimize for mysql
This commit is contained in:
@@ -76,6 +76,7 @@ import com.alibaba.druid.support.logging.Log;
|
||||
import com.alibaba.druid.support.logging.LogFactory;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
import com.alibaba.druid.util.JMXUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
import com.alibaba.druid.wall.WallFilter;
|
||||
|
||||
@@ -351,6 +352,18 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
for (Filter filter : filters) {
|
||||
filter.init(this);
|
||||
}
|
||||
|
||||
if (this.dbType == JdbcConstants.MYSQL) {
|
||||
boolean cacheServerConfigurationSet = false;
|
||||
if (this.connectProperties.containsKey("cacheServerConfiguration")) {
|
||||
cacheServerConfigurationSet = true;
|
||||
} else if (this.jdbcUrl.indexOf("cacheServerConfiguration") != -1) {
|
||||
cacheServerConfigurationSet = true;
|
||||
}
|
||||
if (cacheServerConfigurationSet) {
|
||||
this.connectProperties.put("cacheServerConfiguration", "true");
|
||||
}
|
||||
}
|
||||
|
||||
if (maxActive <= 0) {
|
||||
throw new IllegalArgumentException("illegal maxActive " + maxActive);
|
||||
|
||||
Reference in New Issue
Block a user