Re: import_bytea function (resolved)

From: Stephen Davies <sdavies(at)sdc(dot)com(dot)au>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: import_bytea function (resolved)
Date: 2016-10-09 03:12:10
Message-ID: b79cd388-20b0-cb94-e6e2-207c433d90d5@sdc.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/10/16 17:16, Thomas Kellerer wrote:
> 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)
>
>
>
>

Thanks to all.
Both the update and display now work.

Cheers,
Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Seb 2016-10-09 03:21:30 custom average window function failure
Previous Message Andres Freund 2016-10-08 22:45:32 Re: Lock contention in TransactionIdIsInProgress()