X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 522B7DB6B0 for ; Sun, 13 Nov 2005 19:56:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89469-08 for ; Sun, 13 Nov 2005 23:56:27 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.195]) by svr1.postgresql.org (Postfix) with ESMTP id 8237FDB6F4 for ; Sun, 13 Nov 2005 19:56:28 -0400 (AST) Received: by xproxy.gmail.com with SMTP id i31so949095wxd for ; Sun, 13 Nov 2005 15:56:31 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tpOgqzVCzCiHi1EJ6t6Z3a/Quj38mD5NfEYrb76VNITP414hvQjr9ZByHUxA6jcPIRwAF8Irhwox/mPXDjXPZPxcbA8ewfB7fWkyUruK+lCEM53+3uh+P+caur3oHUMacs+PkRkoL2RdvlRvdHOuG2H2nd240EmH4Kj0xlJDgB8= Received: by 10.65.123.6 with SMTP id a6mr5040320qbn; Sun, 13 Nov 2005 15:56:31 -0800 (PST) Received: by 10.65.95.6 with HTTP; Sun, 13 Nov 2005 15:56:31 -0800 (PST) Message-ID: <4bd3e1480511131556o58dbeae8y7a08dc55927010e0@mail.gmail.com> Date: Sun, 13 Nov 2005 16:56:31 -0700 From: Assad Jarrahian To: Kris Jurka Subject: Re: passing array as parameters to PrepareStatement or callable statement.[setObject() or setArray()] Cc: pgsql-jdbc@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4bd3e1480511120921y6359a0achab46a321b4802219@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.334 required=5 tests=[AWL=0.334] X-Spam-Score: 0.334 X-Spam-Level: X-Archive-Number: 200511/103 X-Sequence-Number: 14201 Hi Kris and all, So I did a quick google search and found out all I need in my new class that implements Array is getBaseType() and toString() [I am not sure this is true since it is not working! Either that or I am doing something wrong] Code below public class IDArray implements Array{ protected int[] myArray; public IDArray(int[] temp ){ .... } =09public int getBaseType() throws SQLException { =09=09return Types.INTEGER; =09} =09public =09String toString(){ =09=09String temp =3D new String(); =09=09temp+=3D"{"; =09=09for (int i=3D0;i wrote: > > > On Sat, 12 Nov 2005, Assad Jarrahian wrote: > > > Hello all, > > my apologies if this question has been asked before. I looked > > through the archives could not find the relevant info (if I overlooked > > something, sorry). > > > > int[] intarray =3D new int[1]; > > getAssociatedLMs.setObject(1, intarray, java.sql.Types.ARRAY); > > //getAssociatedLM's is a callable statement ("{call getLMs(?,?) } "); > > > > so I get a compilation error saying > > org.postgresql.util.PSQLException: Cannot cast an instance of [I to > > type Types.ARRAY > > Currently the driver only supports passing a specific implementation of > java.sql.Array to setObject (and setArray). Other people have posted > helper classes to transform some specific java array types to > java.sql.Array, but these have not been generalized and added to the > driver. > > Kris Jurka >