DataJdbcSource优化

This commit is contained in:
redkale
2023-12-04 09:14:24 +08:00
parent 7522e79f7d
commit 225460f522

View File

@@ -2882,6 +2882,9 @@ public class DataJdbcSource extends AbstractDataSqlSource {
if (password != null) {
this.connectAttrs.put("password", password);
}
if (!url.contains("prepareThreshold=")) {
this.connectAttrs.put("prepareThreshold", "-1");
}
try {
this.driver = DriverManager.getDriver(this.url);
} catch (SQLException e) {
@@ -2914,6 +2917,11 @@ public class DataJdbcSource extends AbstractDataSqlSource {
|| !Objects.equals(newPassword, this.connectAttrs.get("password")) || !Objects.equals(newUrl, url)) {
this.urlVersion.incrementAndGet();
}
if (!newUrl.contains("prepareThreshold=")) {
this.connectAttrs.put("prepareThreshold", "-1");
} else {
this.connectAttrs.remove("prepareThreshold");
}
this.url = newUrl;
this.connectTimeoutSeconds = newConnectTimeoutSeconds;
this.connectAttrs.put("user", newUser);