Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4270F9FB3E8 for ; Tue, 5 Jun 2007 09:59:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 32978-01-2 for ; Tue, 5 Jun 2007 09:59:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 3773A9FB738 for ; Tue, 5 Jun 2007 05:12:11 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from ns1.officenet.no (ns1.officenet.no [193.212.174.3]) by svr4.postgresql.org (Postfix) with ESMTP id 9B9705AF8B1 for ; Tue, 5 Jun 2007 07:39:29 +0000 (GMT) Received: from [85.112.130.182] (helo=krogh-laptop.local) by ns1.officenet.no with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.62) (envelope-from ) id 1HvTd4-0003cR-9r for pgsql-jdbc@postgresql.org; Tue, 05 Jun 2007 09:39:04 +0200 From: Andreas Joseph Krogh Organization: OfficeNet AS To: pgsql-jdbc@postgresql.org Subject: Re: Array paramiters Date: Tue, 5 Jun 2007 09:38:57 +0200 User-Agent: KMail/1.9.7 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200706050938.58019.andreak@officenet.no> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200706/7 X-Sequence-Number: 17069 On Monday 04 June 2007 15:29:32 ben sagal wrote: > I would like to query data based on the values in a java int array ( int[] > ), using a prepared statement similar to: > > "SELECT * FROM items WHERE id IN (?)" > > can anybody advise in have to set the prepared in the statement? You must generate the query manually, by iterating over your array and add = '?'=20 for each element. Then you need to pass each value of the array to=20 setInt(index, array[i]); =2D-=20 Andreas Joseph Krogh Senior Software Developer / Manager =2D-----------------------+---------------------------------------------+ OfficeNet AS | The most difficult thing in the world is to | Karenslyst All=C3=A9 11 | know how to do a thing and to watch | PO. Box 529 Sk=C3=B8yen | somebody else doing it wrong, without | 0214 Oslo | comment. | NORWAY | | Tlf: +47 24 15 38 90 | | =46ax: +47 24 15 38 91 | | Mobile: +47 909 56 963 | | =2D-----------------------+---------------------------------------------+