| From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: import_bytea function |
| Date: | 2016-10-08 06:46:24 |
| Message-ID: | nta4o1$f9f$1@blaine.gmane.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Stephen Davies schrieb am 08.10.2016 um 02:57:
> A follow-up question.
> Once the bytea column is populated, how best to display the content in a web page?
>
> I have :
>
> byte [] imgB;
> ResultSet rs = st1.executeQuery("select pic from part where pno='" + p + "'");
> if(rs.next()){
> imgB = rs.getBytes(1);
> if (imgB != null){
> out.write("Content-type: image/jpeg");
> out.write("Content-length: " + (int)imgB.length);
> out.write(imgB.toString());
> }
> }
>
> but this does not work.
> The toString() looks wrong but removing it makes the write fail.
What is "out"?
(And please use a PreparedStatement to run the SELECT for security reasons)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2016-10-08 12:23:41 | Re: Lock contention in TransactionIdIsInProgress() |
| Previous Message | Stephen Davies | 2016-10-08 06:36:14 | Re: import_bytea function |