class OracleClient(val jdbcClassName: String, jdbcUrl: String, jdbcUser: String, jdbcPasswd: String) {
ConnectionPool.singleton(jdbcUrl, jdbcUser, jdbcPasswd) // default settings
implicit val session: DBSession = AutoSession
private def updateUfDateColumn(ufId: String, columnName: String): Unit = {
val currentDateTime = new Timestamp(System.currentTimeMillis())
val targetDate = FullDateFormat.format(currentDateTime.toLocalDateTime)
logger.info(s"Updating UF row '$ufId', setting $columnName to '$targetDate'")
val query =
s"""UPDATE USAGE_FILES set $columnName=TO_TIMESTAMP('$targetDate', 'YYYY-MM-DD HH24:MI:SS')
|where ID = '${ufId}'""".stripMargin
val result = SQL(query).update.apply()
logger.info(s"UF UPDATE: $result records affected for $ufId")
}
}
Question: is there a way to set the connection pool to auto reconnect in these cases? Any thing I could easily change in my code to avoid getting this problem again?