Search Postgresql Archives

Re: import_bytea function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)




--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux