mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
支持ConnectionProperties属性
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@31 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -468,6 +468,28 @@ public abstract class DruidDataAbstractSource implements DataSource, DataSourceP
|
||||
|
||||
this.connectionProperties = connectionProperties;
|
||||
}
|
||||
|
||||
public void setConnectionProperties(String connectionProperties) {
|
||||
if (connectionProperties == null) throw new NullPointerException("connectionProperties is null");
|
||||
|
||||
String[] entries = connectionProperties.split(";");
|
||||
Properties properties = new Properties();
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
String entry = entries[i];
|
||||
if (entry.length() > 0) {
|
||||
int index = entry.indexOf('=');
|
||||
if (index > 0) {
|
||||
String name = entry.substring(0, index);
|
||||
String value = entry.substring(index + 1);
|
||||
properties.setProperty(name, value);
|
||||
} else {
|
||||
// no value is empty string which is how java.util.Properties works
|
||||
properties.setProperty(entry, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
this.connectionProperties = properties;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return jdbcUrl;
|
||||
|
||||
Reference in New Issue
Block a user