X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6123FD1B387 for ; Fri, 2 Jul 2004 08:43:33 -0300 (ADT) 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 79904-03 for ; Fri, 2 Jul 2004 11:43:31 +0000 (GMT) Received: from kogut3.o2.pl (unknown [217.17.45.9]) by svr1.postgresql.org (Postfix) with ESMTP id 1287ED1B34F for ; Fri, 2 Jul 2004 08:43:27 -0300 (ADT) Received: from [192.168.0.4] (c45-216.icpnet.pl [62.21.45.216]) by kogut3.o2.pl (Postfix) with ESMTP id E827E77CBB for ; Fri, 2 Jul 2004 13:43:04 +0200 (CEST) Message-ID: <40E54A47.1020207@o2.pl> Date: Fri, 02 Jul 2004 13:43:03 +0200 From: =?ISO-8859-2?Q?Rafa=B3_Staniszewski?= User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: JDBC-postgre-list Subject: Arrays and setObject problem Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200407/15 X-Sequence-Number: 10399 Hi all, During development of my web application I found a problem I can't handle. I have a relation: CREATE TABLE public.test ( id int4, tab varchar[] ) WITHOUT OIDS; Using jdbc and prepared statement I'm trying to put data into this table: public add(Connection conn,int id,Vector v) { PreparedStatement pstmt = conn.prepareStatement("insert into test(id,tab) values(?,?)"); pstmt.setInt(1,id); pstmt.setObject(2,v.toArray()); pstmt.executeUpdate(); pstmt.close(); } When I run this I get: e.getErrorCode() -> 0 e.getMessage() -> ERROR: missing dimension value e.getSQLState() -> 22P02 I tried to change 'pstmt.setObject(2,v.toArray());' with: String[] att = new String[v.size()]; for(int i=0;i