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