Subject | Re: [Firebird-Java] Getting BLOBs from FB-Database with JayBird |
---|---|
Author | Roman Rokytskyy |
Post date | 2007-07-13T13:29:38Z |
> The fields are recognized correctly as FBIntegerField and FBBlobField,Note, the position in Blob.getBytes(int, int) starts from 1, not from 0.
> but the method getBytes(long,int) of FBBlob throws a SQLException:
>
> "Couldn't retrieve binary data: org.firebirdsql.jdbc.FBSQLException: I/O
> Exception. Invalid BLOB type for operation"
But that is not the reason.
You use method that allows to fetch data from the BLOB from the
arbitrary position. This requires the seek operation, but seek is only
defined for stream blobs, not for segmented ones. The type of the blob
is specified are creation and by default they are segmented. And BTW,
the segment size nowadays plays no role and in fact there is no
practical difference between those two blob types.
Anyway, the most easy way to get data from Blob are:
ResultSet.getBytes() - fetches all data to the client.
ResultSet.getBinaryStream() - opens a stream.
Hope this helps.
Roman