AnsweredAssumed Answered

JDBC Driver Zeros out Bytes Read After First Read From ResultSet

Question asked by MorkAfur on Dec 16, 2014
Latest reply on May 12, 2015 by MorkAfur


JDBC Driver Zeros out Bytes Read After First Read From ResultSet


FileMaker Pro



Operating system version

Mac 10.10.1

Description of the issue

Try to re-read a container column from a ResultSet results in the bytes read all being zeros the second time read. Other fields types do not exhibit this zero-out behavior and even for very small container fields, you can re-read them from the ResultSet without them getting zeroed.

Steps to reproduce the problem

Create a JDBC connection to a FMP database.

Put an image in the field > 800 KB. The zeroing problem didn't happen with smaller files.

Execute Java code like this from a ResultSet from a SQL Query that brings in the Container field:

(1) byte[] imageBytes = getPictureImageRs.getBytes("image");  --> Image Data Exists as Expected.

Then, again, twice so you see, in the debugger, than imageBytes2 is all zeros!

  (2) byte[] imageBytes2 = getPictureImageRs.getBytes("image");  --> All Zeros!

Expected result

The result in (2) should also be the image data, but if you check in the debugger (for a large file > 800 KB), it'll be all zeros.

Note: you can re-read other fields with no problem from the ResultSet ** AND ** you can even re-read the Container field using the getBytes() call above for SMALL images (50 KB or so).

Actual result

Zeros for the bytes.


Only reading the bytes once into a variable and then repeatedly using the variable - rather than trying to read it from the ResultSet more than once.