Re: [GENERAL] import_bytea function (resolved)

2016-10-08 Thread Stephen Davies
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 + "'"

Re: [GENERAL] import_bytea function

2016-10-08 Thread Thomas Kellerer
Stephen Davies schrieb am 08.10.2016 um 02:57: I will have to regenerate that code to get the exact error message text but it basically said that the parameter substitution was invalid. A follow-up question. Once the bytea column is populated, how best to display the content in a web page? I

Re: [GENERAL] import_bytea function

2016-10-08 Thread Thomas Kellerer
Jan de Visser schrieb am 08.10.2016 um 16:11: You need to stream the data. Working from memory here, and it's been a long time, but it's something like rs = conn.executeQuery("SELECT byeta_column FROM foo WHERE bar = ?"); Blob b = (Blob) rs.getObject(1); No. getBytes() works fine with the JDB

Re: [GENERAL] import_bytea function

2016-10-08 Thread Jan de Visser
On 2016-10-08 2:36 AM, Stephen Davies wrote: On 07/10/16 19:24, Thomas Kellerer wrote: Stephen Davies schrieb am 07.10.2016 um 10:46: You can store the contents of a file in a bytea using plain JDBC no lo_import() required String sql = "insert into images (id, image_data) values (?,?)";

Re: [GENERAL] import_bytea function

2016-10-07 Thread Thomas Kellerer
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 = r

Re: [GENERAL] import_bytea function

2016-10-07 Thread Stephen Davies
On 07/10/16 19:24, Thomas Kellerer wrote: Stephen Davies schrieb am 07.10.2016 um 10:46: You can store the contents of a file in a bytea using plain JDBC no lo_import() required String sql = "insert into images (id, image_data) values (?,?)"; Connection con = ; File uploaded =

Re: [GENERAL] import_bytea function

2016-10-07 Thread Stephen Davies
On 07/10/16 19:24, Thomas Kellerer wrote: Stephen Davies schrieb am 07.10.2016 um 10:46: You can store the contents of a file in a bytea using plain JDBC no lo_import() required String sql = "insert into images (id, image_data) values (?,?)"; Connection con = ; File uploaded =

Re: [GENERAL] import_bytea function

2016-10-07 Thread Thomas Kellerer
Stephen Davies schrieb am 07.10.2016 um 10:46: >> You can store the contents of a file in a bytea using plain JDBC no >> lo_import() required >> >> String sql = "insert into images (id, image_data) values (?,?)"; >> Connection con = ; >> File uploaded = new File("..."); >> Inpu

Re: [GENERAL] import_bytea function

2016-10-07 Thread Stephen Davies
On 07/10/16 18:48, Thomas Kellerer wrote: Stephen Davies schrieb am 07.10.2016 um 09:12: I am trying to use the import_bytea function described in various list posts (PG version 9.3.14) in a jsp. I get an error saying that only the super user can use server-side lo_import(). If I change the J

Re: [GENERAL] import_bytea function

2016-10-07 Thread Thomas Kellerer
Stephen Davies schrieb am 07.10.2016 um 09:12: > I am trying to use the import_bytea function described in various list posts > (PG version 9.3.14) in a jsp. > > I get an error saying that only the super user can use server-side > lo_import(). > > If I change the Java connection to use user pos

[GENERAL] import_bytea function

2016-10-07 Thread Stephen Davies
I am trying to use the import_bytea function described in various list posts (PG version 9.3.14) in a jsp. I get an error saying that only the super user can use server-side lo_import(). If I change the Java connection to use user postgres, the function works but I would prefer not to do this.