mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 11:06:49 +00:00
closing database connections after StoredProcedure calls and Migrations.
This commit is contained in:
parent
6ad3689fd3
commit
7efbf6389a
@ -648,8 +648,11 @@ object Migration extends MdcLoggable {
|
||||
if (performWrite) {
|
||||
logFunc(ct)
|
||||
val st = conn.createStatement
|
||||
st.execute(ct)
|
||||
st.close
|
||||
try {
|
||||
st.execute(ct)
|
||||
} finally {
|
||||
st.close()
|
||||
}
|
||||
}
|
||||
ct
|
||||
}
|
||||
|
||||
@ -58,12 +58,15 @@ object StoredProcedureUtils extends MdcLoggable{
|
||||
val sql = s"{ CALL $procedureName(?, ?) }"
|
||||
|
||||
val callableStatement = conn.prepareCall(sql)
|
||||
callableStatement.setString(1, procedureParam)
|
||||
|
||||
callableStatement.registerOutParameter(2, java.sql.Types.LONGVARCHAR)
|
||||
// callableStatement.setString(2, "") // MS sql server must comment this line, other DB need check.
|
||||
callableStatement.executeUpdate()
|
||||
callableStatement.getString(2)
|
||||
try {
|
||||
callableStatement.setString(1, procedureParam)
|
||||
callableStatement.registerOutParameter(2, java.sql.Types.LONGVARCHAR)
|
||||
// callableStatement.setString(2, "") // MS sql server must comment this line, other DB need check.
|
||||
callableStatement.executeUpdate()
|
||||
callableStatement.getString(2)
|
||||
} finally {
|
||||
callableStatement.close()
|
||||
}
|
||||
}
|
||||
logger.debug(s"${StoredProcedureConnector_vDec2019.toString} inBoundJson: $procedureName = $responseJson" )
|
||||
Connector.extractAdapterResponse[T](responseJson, Empty)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user