Zum Inhalt springen

DB Connection Not Closed (ARCH8084)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key kotlin.performance.db-connection-not-closed · Severity error · Category performance

Flags DriverManager.getConnection / dataSource.connection / prepareStatement whose result is not wrapped in use { } or closed in finally.

val c = dataSource.connection
c.prepareStatement(sql).execute()
dataSource.connection.use { c -> c.prepareStatement(sql).use { it.execute() } }

Wrap connections and statements in use { } so they return to the pool on every path.