You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/07/07 02:33:03 UTC

[GitHub] [shardingsphere] TeslaCN commented on a change in pull request #11185: For #11100, change 'add reource' syntax and allow custom properties for connection pool.

TeslaCN commented on a change in pull request #11185:
URL: https://github.com/apache/shardingsphere/pull/11185#discussion_r664996820



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/decorator/HikariJDBCParameterDecorator.java
##########
@@ -27,23 +28,33 @@
     
     @Override
     public HikariDataSource decorate(final HikariDataSource dataSource) {
-        dataSource.getDataSourceProperties().setProperty("useServerPrepStmts", Boolean.TRUE.toString());
-        dataSource.getDataSourceProperties().setProperty("cachePrepStmts", Boolean.TRUE.toString());
-        dataSource.getDataSourceProperties().setProperty("prepStmtCacheSize", "200000");
-        dataSource.getDataSourceProperties().setProperty("prepStmtCacheSqlLimit", "2048");
-        dataSource.getDataSourceProperties().setProperty("useLocalSessionState", Boolean.TRUE.toString());
-        dataSource.getDataSourceProperties().setProperty("rewriteBatchedStatements", Boolean.TRUE.toString());
-        dataSource.getDataSourceProperties().setProperty("cacheResultSetMetadata", Boolean.FALSE.toString());
-        dataSource.getDataSourceProperties().setProperty("cacheServerConfiguration", Boolean.TRUE.toString());
-        dataSource.getDataSourceProperties().setProperty("elideSetAutoCommits", Boolean.TRUE.toString());
-        dataSource.getDataSourceProperties().setProperty("maintainTimeStats", Boolean.FALSE.toString());
-        dataSource.getDataSourceProperties().setProperty("netTimeoutForStreamingResults", "0");
-        dataSource.getDataSourceProperties().setProperty("tinyInt1isBit", Boolean.FALSE.toString());
+        addJDBCProperty(dataSource, "useServerPrepStmts", Boolean.TRUE.toString());
+        addJDBCProperty(dataSource, "useServerPrepStmts", Boolean.TRUE.toString());
+        addJDBCProperty(dataSource, "cachePrepStmts", Boolean.TRUE.toString());
+        addJDBCProperty(dataSource, "prepStmtCacheSize", "200000");
+        addJDBCProperty(dataSource, "prepStmtCacheSqlLimit", "2048");
+        addJDBCProperty(dataSource, "useLocalSessionState", Boolean.TRUE.toString());
+        addJDBCProperty(dataSource, "rewriteBatchedStatements", Boolean.TRUE.toString());
+        addJDBCProperty(dataSource, "cacheResultSetMetadata", Boolean.FALSE.toString());
+        addJDBCProperty(dataSource, "cacheServerConfiguration", Boolean.TRUE.toString());
+        addJDBCProperty(dataSource, "elideSetAutoCommits", Boolean.TRUE.toString());
+        addJDBCProperty(dataSource, "maintainTimeStats", Boolean.FALSE.toString());
+        addJDBCProperty(dataSource, "netTimeoutForStreamingResults", "0");
+        addJDBCProperty(dataSource, "tinyInt1isBit", Boolean.FALSE.toString());
+        addJDBCProperty(dataSource, "useSSL", Boolean.FALSE.toString());
+        addJDBCProperty(dataSource, "serverTimezone", "UTC");

Review comment:
       I read some code of MySQL JDBC Driver 5.1.47. There is a doc for `com.mysql.jdbc.NonRegisteringDriver#connect`wrote
   >  The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. These properties take precedence over any properties sent in the URL.
   
   My understanding is that the parameters such as `useSSL=true` we write in the URL will not work.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org