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
org.firebirdsql.jdbc.FBSQLException: Exception. couldn't close blob: org.firebirdsql.gds.GDSException: invalid BLOB handle [JDBC400] #181
Comments
Modified by: Attila Molnár (e_pluribus_unum)Attachment: TEST.ZIP [ 12753 ] |
Commented by: @mrotteveel The blob is getting closed by the rollback, but Jaybird seems to think it is still open and then tries to close it again on close of the connection. |
Modified by: @mrotteveelVersion: Jaybird 2.2.7 [ 10660 ] Version: Jaybird 2.2.6 [ 10588 ] Version: Jaybird 2.2.5 [ 10582 ] Version: Jaybird 2.2.4 [ 10531 ] Version: Jaybird 2.2.3 [ 10510 ] Version: Jaybird 2.2.2 [ 10480 ] Version: Jaybird 2.2.1 [ 10474 ] Version: Jaybird 2.2 [ 10053 ] |
Commented by: @mrotteveel I can reproduce this in earlier version as well (I tried Jaybird 2.2.7, 2.2.4, 2.2.0 and 2.1.6). It has essentially always been broken. It is not related to DBCP as it is also reproducible without DBCP. Simplest code to reproduce is:
Workaround for this problem: use try-with-resources for the result set and for the inputstream obtained from the result set (or explicitly close() the input stream), eg:
|
Modified by: @mrotteveel |
Commented by: @mrotteveel Root cause seems to be JDBC307. |
Commented by: @mrotteveel As to why it did work with DBCP 1, I'd guess that DBCP 1 explicitly closes the result set before roll back, and DBCP 2 trusts the driver to do the right thing. I haven't looked at the DBCP code though, so that is just a guess. |
Commented by: @mrotteveel Rescheduled JDBC307 for 2.2.9; I will keep this ticket open and track it separately to improve test coverage. |
Commented by: Attila Molnár (e_pluribus_unum) Hi! Using InputStream and ResultSet close() worked. Thank You! |
Commented by: @mrotteveel Added extra tests to verify fix of JDBC307 also fixed this. |
Modified by: @mrotteveelstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Attila Molnár (e_pluribus_unum)
Is related to JDBC307
Attachments:
TEST.ZIP
Hi Mark!
org.apache.commons.dbcp2.BasicDataSource ds = new BasicDataSource();//dbcp2!
ds.setUsername("SYSDBA");
ds.setPassword("masterkey");
ds.setUrl("jdbc:firebirdsql:l3s-4/3051:d:\\\\test.fdb?charSet\\=UTF-8&TRANSACTION_READ_COMMITTED\\=isc_tpb_read_committed,isc_rec_version,isc_tpb_nowait&isc_dpb_sql_dialect=1");
Connection conn = ds.getConnection();
conn.setAutoCommit(false);
PreparedStatement s = conn.prepareStatement("SELECT blob_data from test");
ResultSet rs = s.executeQuery();
rs.next();
InputStream is = rs.getBinaryStream(1);
ByteArrayOutputStream os = new ByteArrayOutputStream();
StreamUtils.copy(is, os);
conn.rollback();
conn.close();
Error on conn.close() call.
Works fine with org.apache.commons.dbcp.BasicDataSource.
It this a Jaybird or a commons-dbcp2 BasicDataSource bug?
Thank you!
Commits: 30bfd96 9dc237e
The text was updated successfully, but these errors were encountered: