Re: [GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-05 Thread Dave Cramer
So we can consider this matter closed ? CallableStatements are necessary because postgres has to use select to call a function. Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On 4 May 2015 at 18:06, Nanker Phelge wrote: > The database function does not use out parameters or

Re: [GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-04 Thread Nanker Phelge
The database function does not use out parameters or a ref cursor, which was why I was confused. The Java sample I provided is a simplification of the built-in default logic of the Spring Batch ItemWriter - I put it into my own implementation class to help with debugging. The root cause seems to b

Re: [GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-04 Thread Dave Cramer
The logs from the server would be useful Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On 4 May 2015 at 07:05, Thomas Kellerer wrote: > Hannes Erven schrieb am 04.05.2015 um 12:31: > > Hi, > > > > > >> String sql = "select test_user_result_insert_func(?, ?, ?);"; >

Re: [GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-04 Thread Thomas Kellerer
Hannes Erven schrieb am 04.05.2015 um 12:31: > Hi, > > >> String sql = "select test_user_result_insert_func(?, ?, ?);"; > > You can't call functions via JDBC like that. That's perfectly valid - unless the function uses out parameters or ref cursors. I am however unsure about batche

Re: [GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-04 Thread Hannes Erven
Hi, > String sql = "select test_user_result_insert_func(?, ?, ?);"; You can't call functions via JDBC like that. You need to use: CallableStatement cs = connection.prepareCall("{call func(?,?,?)}"); // Loop starts... cs.clearParameters(); cs.setString(1, "foo"); cs.setString(2, "bar"

Re: [GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-03 Thread David G. Johnston
On Sun, May 3, 2015 at 2:33 PM, Nanker Phelge wrote: > inner ex 2 =A result was returned when none was expected. > > ​I don't know what is or is not allowed by JDBC but it is reasonable to assume that you cannot create batches of SELECT statements. The intent of batching is to repeatedly execute

Re: [GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-03 Thread Adrian Klaver
On 05/03/2015 02:33 PM, Nanker Phelge wrote: I am attempting to setup a Spring Batch ItemWriter to call a function in PostgreSQL to insert the provided objects. I posted the details to stackoverflow a month ago (http://stackoverflow.com/questions/28971220/spring-batch-itemwriter-error-with-postg

[GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-03 Thread Nanker Phelge
I am attempting to setup a Spring Batch ItemWriter to call a function in PostgreSQL to insert the provided objects. I posted the details to stackoverflow a month ago ( http://stackoverflow.com/questions/28971220/spring-batch-itemwriter-error-with-postgresql-function) with no answers, and I just fo