Skip to content

Fix ClassCastException with pooled connections in DefaultOutputBuffer - #111

Merged
jgebal merged 2 commits into
developfrom
bugfix/issue_110_pooled_connection_cast
Oct 2, 2026
Merged

jgebal merged 2 commits into
developfrom
bugfix/issue_110_pooled_connection_cast

Conversation

@jgebal

@jgebal jgebal commented Oct 2, 2026

Copy link
Copy Markdown
Member

Fixes #110

Connection pools such as HikariCP return proxy statements that are not instances of OracleCallableStatement, so fetching reporter output with a pooled connection failed in DefaultOutputBuffer.getLinesCursorStatement. The cast was never needed, because only standard CallableStatement methods are used. It is replaced with a plain CallableStatement, the same way CompatibilityOutputBufferPre310 already does it.

Also close the statement created in Reporter.initDbReporter. It was never closed, so every Reporter.init leaked an open cursor. On long-lived pooled connections this can lead to ORA-01000.

Add unit tests for both cases using mocked, non-Oracle JDBC objects.

Fixes #110

Connection pools such as HikariCP return proxy statements that are not
instances of OracleCallableStatement, so fetching reporter output with a
pooled connection failed in DefaultOutputBuffer.getLinesCursorStatement.
The cast was never needed, because only standard CallableStatement
methods are used. It is replaced with a plain CallableStatement, the same
way CompatibilityOutputBufferPre310 already does it.

Also close the statement created in Reporter.initDbReporter. It was never
closed, so every Reporter.init leaked an open cursor. On long-lived
pooled connections this can lead to ORA-01000.

Add unit tests for both cases using mocked, non-Oracle JDBC objects.
Comment thread src/main/java/org/utplsql/api/outputBuffer/DefaultOutputBuffer.java Fixed
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

26 files  +2  26 suites  +2   16s ⏱️ -1s
77 tests +4  77 ✅ +4  0 💤 ±0  0 ❌ ±0 
89 runs  +4  89 ✅ +4  0 💤 ±0  0 ❌ ±0 

Results for commit d623cff. ± Comparison against base commit f443528.

♻️ This comment has been updated with latest results.

…e in

a shared helper in AbstractOutputBuffer. The helper closes the statement
if binding fails, so it no longer leaks on that error path.
@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

@jgebal
jgebal merged commit 12d24f2 into develop Oct 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClassCastException when using Hikari Database Pool

2 participants