Skip to content

Commit

Permalink
[fix-4653]fix jdbc connection cache error (#4654)
Browse files Browse the repository at this point in the history
* fix jdbc connection cache

* Modify the nonnull judgment

* Update JDBCEngineConnExecutor.scala

add annotation
  • Loading branch information
aiceflower authored Jun 19, 2023
1 parent 466f398 commit 7b1419d
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down

0 comments on commit 7b1419d

Please sign in to comment.