From: | "Ludovico Bianchini" <metlud(at)yahoo(dot)it> |
---|---|
To: | "Giuseppe Sacco" <giuseppe(at)eppesuigoccas(dot)homedns(dot)org> |
Cc: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: ResultSet with more than 5 rows causes error |
Date: | 2007-09-27 16:45:20 |
Message-ID: | 00ea01c80125$cc3d0d30$4101a8c0@MRHYDE |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
----- Original Message -----
From: "Giuseppe Sacco" <giuseppe(at)eppesuigoccas(dot)homedns(dot)org>
To: "Ludovico Bianchini" <metlud(at)yahoo(dot)it>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Sent: Thursday, September 27, 2007 6:27 PM
Subject: Re: [JDBC] ResultSet with more than 5 rows causes error
> Il giorno gio, 27/09/2007 alle 12.20 +0200, Ludovico Bianchini ha
> scritto:
> [...]
>> while(source.next()) {
>> insertCall.registerOutParameter(1, Types.INTEGER);
>> for (int i = 1; i <= colCount; i++) {
>> data = source.getObject(i);
>> insertCall.setObject(i+1, data);
>> }
>> insertCall.execute();
> [...]
>
> I never used CallableStatement, but I do think you should use
> insertCall.setObject(i,data)
> instead of
> insertCall.setObject(i+1,data)
>
>
The stored procedure returns an integer parameter, which must be registered
with
insertCall.registerOutParameter(1, Types.INTEGER);
In a first attempt I wrote
insertCall.setObject(i,data);
but an error happened: the last parameter was not set. So: if there is a
return value, the arguments index starts from 2.
Really it's work fine for first 5 rows.
With this modification (create a new CallableStatement for every row)
[..]
insertCall.execute();
insertCall.close();
insertCall = remoteConnection.prepareCall(Costanti.FUNCTION_INSERT);
[..]
the code works, but I think the problem has to be solve deeply.
Chiacchiera con i tuoi amici in tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Giuseppe Sacco | 2007-09-27 17:44:05 | Re: ResultSet with more than 5 rows causes error |
Previous Message | Giuseppe Sacco | 2007-09-27 16:27:07 | Re: ResultSet with more than 5 rows causes error |