This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Error code 20000, SQL state XCL18: Stream or LOB value cannot be retrieved more than once | ||
---|---|---|---|
Product: | db | Reporter: | jirbol |
Component: | Code | Assignee: | Libor Fischmeistr <lfischmeistr> |
Status: | RESOLVED FIXED | ||
Severity: | normal | Keywords: | PATCH_AVAILABLE |
Priority: | P3 | ||
Version: | 7.3.1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | IDE log |
Description
jirbol
2013-10-26 09:03:00 UTC
Created attachment 141583 [details]
IDE log
This is reproducible: create table xy (tex char(20) for bit data); insert into xy ( tex ) VALUES (X'01FF'); select * from APP.XY; drop table xy; I suggest to unify the BLOB/BINARY handling into using the stream methods. I would expect them to work better than the blob ones. To support the blob interface streaming has to be implemented so its sensible to expect streaming on the resultset to work. Accessing as a blob is indeed not the best idea if the database invalidates the result after the first access. A quick google search found several document documenting binary access via getBinaryStream, some explicit support from dbms (informix, db2), none described problems. Change in DBReadWriteHelper.java: # This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and \n newlines. --- Base (BASE) +++ Locally Modified (Based On LOCAL) @@ -206,38 +206,8 @@ case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BLOB: { - // Try to get a blob object + // Load binary data as stream and hold it internally as a pseudoblob try { - Blob blob = rs.getBlob(index); - - if (blob == null) { - return null; - } - - Object result = null; - - if (! rs.wasNull()) { - result = new FileBackedBlob(blob.getBinaryStream()); - } - - try { - blob.free(); - } catch (java.lang.AbstractMethodError err) { - // Blob gained a new method in jdbc4 (drivers compiled - // against older jdks don't provide this methid - } catch (SQLException ex) { - // DBMS failed to free resource or does not support call - // ignore this, as we can't do more - } - - return result; - // Ok - can happen - the jdbc driver might not support - // blob data or can for example not provide a longvarbinary - // as blob - so fall back to our implementation of blob - } catch (SQLException ex) { - } catch (java.lang.UnsupportedOperationException ex) { - } - try { InputStream is = rs.getBinaryStream(index); if (is == null) { return null; @@ -245,20 +215,9 @@ return new FileBackedBlob(is); } } catch (SQLDataException x) { - // wrong mapping JavaDB JDBC Type -4 - try { - String sdata = rs.getString(index); - if (rs.wasNull()) { - return null; - } else { - return sdata; - } - } catch (SQLException ex) { - // throw the original SQLDataException intead of this one throw x; } } - } case Types.LONGVARCHAR: case -16: case Types.CLOB: Patch applied: http://hg.netbeans.org/core-main/rev/9c60c53d6f7f Matthias, thanks you very much for the patch. |