Intermittent JDBC connection pool exhaustion in Wolfram DatabaseLink
0 reputation · 15 Dec 2020, 22:02 UTC
Goal
Determine whether Wolfram Language DatabaseLink reliably returns a JDBC connection to the pool when evaluation ends abnormally, or whether cleanup depends on object finalization and driver-specific timeouts.
Constraints and uncertainty
DatabaseLink makes connection lifecycle explicit through OpenSQLConnection and CloseSQLConnection. The pool itself is typically owned by the JDBC driver, database, or application server, not by the Wolfram kernel, so pool size and idle timeout are external settings. If a SQL operation fails, the kernel aborts, or the session exits before CloseSQLConnection runs, server-side sessions may persist until a timeout or driver cleanup. Exact return timing is version-, driver-, and database-dependent and should not be treated as deterministic.
Does DatabaseLink guarantee that CloseSQLConnection runs after every failing SQL path? Is explicit close required on both success and failure branches to prevent intermittent pool exhaustion? Should connection counts be compared client-side and database-side under the same parallel-kernel configuration that reproduces the issue?