try
{
stmt = conn.createStatement();
rs = stmt.executeQuery("select a,b from testBlob");
int i = 0, blobLength = 0;
Blob blob;
while (rs.next())
{
i++;
blob = rs.getBlob(1);
if (blob == null)
continue;
blobLength = rs.getInt(2);
blobclob4BLOB.printInterval(blob, 9905, 50, 0, i, blobLength);
blobclob4BLOB.printInterval(blob, 5910, 150, 1, i, blobLength);
blobclob4BLOB.printInterval(blob, 5910, 50, 2, i, blobLength);
blobclob4BLOB.printInterval(blob, 204, 50, 3, i, blobLength);
blobclob4BLOB.printInterval(blob, 68, 50, 4, i, blobLength);
blobclob4BLOB.printInterval(blob, 1, 50, 5, i, blobLength);
blobclob4BLOB.printInterval(blob, 1, 1, 6, i, blobLength);
blobclob4BLOB.printInterval(
blob, 1, 0, 7, i, blobLength); // length 0 at start
blobclob4BLOB.printInterval(
blob, blobLength + 1, 0, 8, i, blobLength); // and end
/*
System.out.println(i + "(0) " + new String(blob.getBytes(9905,50), "US-ASCII"));
System.out.println(i + "(1) " + new String(blob.getBytes(5910,150), "US-ASCII"));
System.out.println(i + "(2) " + new String(blob.getBytes(5910,50), "US-ASCII"));
System.out.println(i + "(3) " + new String(blob.getBytes(204,50), "US-ASCII"));
System.out.println(i + "(4) " + new String(blob.getBytes(68,50), "US-ASCII"));
System.out.println(i + "(5) " + new String(blob.getBytes(1,50), "US-ASCII"));
System.out.println(i + "(6) " + new String(blob.getBytes(1,1), "US-ASCII"));
*/
if (blobLength > 100)
{
byte[] res = blob.getBytes(blobLength-99,200);
System.out.println(i + "(9) ");
if (res.length != 100)
System.out.println("FAIL : length of bytes is " +
res.length + " should be 100");
else