Subject Blob Performance hints?
Author Rick Fincher
Hi All,

I'm working on a servlet that stores and reads blobs from Firebird using
Jaybird. All is working OK, except the speed of retrieving the blobs seems
very slow compared to a write.

Anybody have any hints on how to improve performance?

Should Iincrease the initial size of the byte array and/or match it to
multiples of the block size of the blob's database?

I'm using getBinaryStream to get the blob stream from the result set. in = rs.getBinaryStream("BINARYFILE");

Thanks for any hints!

The code that does the reading is as follows:

pStatement = conn.prepareStatement(qStr);

rs = pStatement.executeQuery();

boolean rsEmpty =;


javax.servlet.ServletOutputStream out =
response.getOutputStream(); in = rs.getBinaryStream("BINARYFILE"); baos = new;
int bytes;
byte b[] = new byte[1024];
while (true)
bytes =;
if (bytes == -1)

baos.write(b, 0, bytes);

b = baos.toByteArray();

out.write(b, 0, b.length);