From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Nanker Phelge <n(dot)phelge01(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Errors using JDBC batchUpdate with plpgsql function |
Date: | 2015-05-05 13:02:11 |
Message-ID: | CADK3HH+N32ft5L5qi4ig92DALvYpwEWi=y0VCH7SHWqHk3yfyA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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 <n(dot)phelge01(at)gmail(dot)com> wrote:
> 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
> be the JDBC driver thinking that there should not be results because it is
> an update and the 'select' influencing that decision. I tried switching
> this ItemWriter implementation to use a CallableStatement, and that did
> work, but I wanted to understand why the approach I listed in the original
> post didn't work.
>
> Thanks
>
>
>
> On Mon, May 4, 2015 at 6:05 AM, Thomas Kellerer <spam_eater(at)gmx(dot)net>
> wrote:
>
>> 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 batched statements here. So trying
>> CallableStatement is definitely worth a shot.
>>
>>
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2015-05-05 13:45:55 | Re: Standby problem after restore_command Implementation |
Previous Message | Vincent Veyron | 2015-05-05 11:45:54 | Re: PGFoundry Sample databases (particularly world)? |