-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor.close() closes its statement even if the ExecutorType is REUSE #1351
Comments
Thank you, @ryo-murai ! @gdarmont |
Hi, I did not foresee such usage, so I did not test that case. |
Hi @gdarmont , Thank you for the comment! |
I did quick tests using a simple JDBC app and found a few drivers that do not support
It may not be a big problem to hsqldb and h2 users, but it could be to Sybase users. |
Hi ! Regarding to the SAP ASE jConnect, it supports JDBC 4.0 specification, according to the online manual site. And sadly I can't find any newer version other than the 'SAP jConnect for JDBC 16.0' above stated... IMHO of another way to fix, let Executor tell Cursor its mode or flags so that the Cursor could determine to close or not close its statement... It seems straightforward but I have no idea on how this impacts those design. |
It may be possible to fix this without using As MyBatis 3.5.0 requires Java 8, it's not so unreasonable to require JDBC 4.1 (=Java 7) compliant driver to use Cursor, I think. @kazuki43zoo , |
@harawata I agree with your opinion. |
Great! I'll work on it. |
Hi all, The fix has been committed. |
Just to add on this, hive jdbc driver also does not implement this method 😢 |
For information the method closeOnCompletion is not implemented in Apache Phoenix at this time |
@arhont375 , @remika |
HIVE-22698 has been merged (fix version = 4.0.0). 🎉 |
SAP ASE 16 SP04 contains a new driver jconn42.jar which supports |
- Closing Statement may be an executor's responsibility. - Using Cursor now requires drivers that support Statement#closeOnCompletion() (JDBC 4.1+).
DefaultCursor.java L117
Cursor.close() method always closes its statement object regardless the ExecutorType.
In case the ExecuteType is REUSE, it will cause a problem because the Prepared Statement will also be closed and no longer reusable.
MyBatis version
3.4.6
Database vendor and version
postgresql 9.4
Test case or example project
to quickly reproduce the problem, modify some existing tests like below.
Steps to reproduce
see above test case.
please note that the problem didn't occur on h2db.
Expected result
Actual result
The text was updated successfully, but these errors were encountered: