From: | Alessandro Pellegrini <alessandro(dot)pellegrini(at)infoblu(dot)it> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Blob column |
Date: | 2003-05-16 15:54:08 |
Message-ID: | 3EC509A0.4000202@infoblu.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I'm trying to write a servlet to read and serve
images stored in a table as blob.
I've an instance of PG 7.3 on a redhat 7.3 box
with a DB created using the ENCODING='LATIN1' option.
My servlet runs in tomcat4.1.24+j2sdk1.4.1_02 environment
with the pg73jdbc2.jar library installed.
I've tried to store my jpeg image in a TEXT field and in an OID field
(and I can see it with a win32 client)
but using this code (that's OK with mysql)
...
BufferedInputStream blobBIS =
new BufferedInputStream(rs.getBinaryStream("image_blob));
byte[] buf = new byte[4 * 1024]; // 4K buffer
int len;
ServletOutputStream binout = response.getOutputStream();
while ((len = blobBIS.read(buf, 0, buf.length)) != -1)
binout.write(buf, 0, len);
blobBIS.close();
binout.close();
...
the stream closes after a few (6/7) bytes.
What's wrong?
Thanks a lot.
Alessandro
alessandro(dot)pellegrini(at)infoblu(dot)it
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2003-05-16 17:25:23 | Re: Problem about executeUpdate and stored procedure that |
Previous Message | Han | 2003-05-16 07:00:27 | Problem about executeUpdate and stored procedure that returns nothing |