You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2023/06/19 01:46:44 UTC
[linkis] branch dev-1.4.0 updated: [fix-4653]fix jdbc connection cache error (#4654)
This is an automated email from the ASF dual-hosted git repository.
casion pushed a commit to branch dev-1.4.0
in repository https://gitbox.apache.org/repos/asf/linkis.git
The following commit(s) were added to refs/heads/dev-1.4.0 by this push:
new 7b1419d4b [fix-4653]fix jdbc connection cache error (#4654)
7b1419d4b is described below
commit 7b1419d4b80b1a417ca628d23588ec2b8a4c4177
Author: aiceflower <ki...@gmail.com>
AuthorDate: Mon Jun 19 09:46:39 2023 +0800
[fix-4653]fix jdbc connection cache error (#4654)
* fix jdbc connection cache
* Modify the nonnull judgment
* Update JDBCEngineConnExecutor.scala
add annotation
---
.../engineplugin/jdbc/executor/JDBCEngineConnExecutor.scala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/linkis-engineconn-plugins/jdbc/src/main/scala/org/apache/linkis/manager/engineplugin/jdbc/executor/JDBCEngineConnExecutor.scala b/linkis-engineconn-plugins/jdbc/src/main/scala/org/apache/linkis/manager/engineplugin/jdbc/executor/JDBCEngineConnExecutor.scala
index 511a626c8..336d1197f 100644
--- a/linkis-engineconn-plugins/jdbc/src/main/scala/org/apache/linkis/manager/engineplugin/jdbc/executor/JDBCEngineConnExecutor.scala
+++ b/linkis-engineconn-plugins/jdbc/src/main/scala/org/apache/linkis/manager/engineplugin/jdbc/executor/JDBCEngineConnExecutor.scala
@@ -115,7 +115,15 @@ class JDBCEngineConnExecutor(override val outputPrintLimit: Int, val id: Int)
var resultSet: ResultSet = null
logger.info(s"The data source properties is $properties")
Utils.tryCatch({
- val dataSourceIdentifier = s"$dataSourceName-$dataSourceMaxVersionId"
+ /* url + user as the cache key */
+ val jdbcUrl: String = properties.get(JDBCEngineConnConstant.JDBC_URL)
+ val execUser: String = properties.get(JDBCEngineConnConstant.JDBC_SCRIPTS_EXEC_USER)
+ val proxyUser: String = properties.get(JDBCEngineConnConstant.JDBC_PROXY_USER_PROPERTY)
+ var dataSourceIdentifier = s"$jdbcUrl-$execUser-$proxyUser"
+ /* If datasource is used, use datasource name as the cache key */
+ if (StringUtils.isNotBlank(dataSourceName)) {
+ dataSourceIdentifier = s"$dataSourceName-$dataSourceMaxVersionId"
+ }
connection = connectionManager.getConnection(dataSourceIdentifier, properties)
logger.info("The jdbc connection has created successfully!")
}) { e: Throwable =>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org