Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 290B79FA49F for ; Thu, 27 Sep 2007 13:44:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 03310-05 for ; Thu, 27 Sep 2007 13:44:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smtp002.mail.ukl.yahoo.com (smtp002.mail.ukl.yahoo.com [217.12.11.33]) by postgresql.org (Postfix) with SMTP id 44FF29FA43D for ; Thu, 27 Sep 2007 13:44:36 -0300 (ADT) Received: (qmail 19857 invoked from network); 27 Sep 2007 16:44:35 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.it; h=Received:X-YMail-OSG:Message-ID:From:To:Cc:References:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Priority:X-MSMail-Priority:X-Mailer:X-MimeOLE:X-Antivirus:X-Antivirus-Status; b=kdx8s314RjnyCHBWad4mD8mvkBKS78bLdOqQRld9GiPN8KAnmQcZAjpRZLhNFFGgn4UR5/1iw1uv6Uyjx0cG+Lmz6ihRYnRyzuVZunThc7DUnsL4UhwDDX4Y5GIhskE3BGaOmAdNPjkh9EFX6DNekyhDlYqQfcUe48Di8RRShmM= ; Received: from unknown (HELO MRHYDE) (metlud@87.9.238.202 with login) by smtp002.mail.ukl.yahoo.com with SMTP; 27 Sep 2007 16:44:34 -0000 X-YMail-OSG: oxmRjgQVM1n2nBYVypoFdSOyd5mXfbF8kK1FmagLMZNpRnsM Message-ID: <00ea01c80125$cc3d0d30$4101a8c0@MRHYDE> From: "Ludovico Bianchini" To: "Giuseppe Sacco" Cc: References: <520533.88896.qm@web31903.mail.mud.yahoo.com> <1190910427.18730.35.camel@scarafaggio> Subject: Re: ResultSet with more than 5 rows causes error Date: Thu, 27 Sep 2007 18:45:20 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Antivirus: avast! (VPS 000777-1, 26/09/2007), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.008 tagged_above=0 required=5 tests=AWL=1.006, BAYES_50=0.001, STOX_REPLY_TYPE=0.001 X-Spam-Level: * X-Archive-Number: 200709/122 X-Sequence-Number: 17544 ----- Original Message ----- From: "Giuseppe Sacco" To: "Ludovico Bianchini" Cc: 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