Browse Source

AbstractDriverBasedDataSource does not rely on Properties chaining anymore

Issue: SPR-9461
3.1.x
Juergen Hoeller 13 years ago
parent
commit
f3d0beb955
  1. 13
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/AbstractDriverBasedDataSource.java

13
org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/AbstractDriverBasedDataSource.java

@ -139,15 +139,18 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
* @see java.sql.Driver#connect(String, java.util.Properties) * @see java.sql.Driver#connect(String, java.util.Properties)
*/ */
protected Connection getConnectionFromDriver(String username, String password) throws SQLException { protected Connection getConnectionFromDriver(String username, String password) throws SQLException {
Properties props = new Properties(); Properties mergedProps = new Properties();
props.putAll(getConnectionProperties()); Properties connProps = getConnectionProperties();
if (connProps != null) {
mergedProps.putAll(connProps);
}
if (username != null) { if (username != null) {
props.setProperty("user", username); mergedProps.setProperty("user", username);
} }
if (password != null) { if (password != null) {
props.setProperty("password", password); mergedProps.setProperty("password", password);
} }
return getConnectionFromDriver(props); return getConnectionFromDriver(mergedProps);
} }
/** /**

Loading…
Cancel
Save