[branch-2.1][improvement](sqlserver catalog) Configurable whether to use encrypt when connecting to SQL Server using the catalog (#36971)

pick (#36659)
pick #37015
In previous versions, we used druid as the default JDBC connection pool,
which can use custom decryption to parse the certificate when SQL Server
encryption is turned on. However, in the new version, after changing
HikariCP as the default connection pool, the SQLServer certificate
cannot be parsed, so encryption needs to be turned off for normal use.
Therefore, a parameter is added to decide whether to disable SQLServer
encryption. It is not disabled by default.
This commit is contained in:
zy-kkk
2024-07-02 10:14:43 +08:00
committed by GitHub
parent 6f944549d1
commit 3f382b797a
2 changed files with 7 additions and 0 deletions

View File

@ -353,6 +353,9 @@ public class JdbcResource extends Resource {
newJdbcUrl = checkAndSetJdbcBoolParam(dbType, newJdbcUrl, "reWriteBatchedInserts", "false", "true");
}
if (dbType.equals(SQLSERVER)) {
if (Config.force_sqlserver_jdbc_encrypt_false) {
newJdbcUrl = checkAndSetJdbcBoolParam(dbType, newJdbcUrl, "encrypt", "true", "false");
}
newJdbcUrl = checkAndSetJdbcBoolParam(dbType, newJdbcUrl, "useBulkCopyForBatchInsert", "false", "true");
}
return newJdbcUrl;