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 1C2A153392 for ; Wed, 23 Mar 2005 19:21:35 +0000 (GMT) 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 93266-05 for ; Wed, 23 Mar 2005 19:21:34 +0000 (GMT) Received: from mail.liquidcore.com (mail.liquidcore.net [68.17.96.60]) by svr1.postgresql.org (Postfix) with ESMTP id 8BCDB52A3D for ; Wed, 23 Mar 2005 19:21:32 +0000 (GMT) Received: (from root@localhost) by mail.liquidcore.com (8.13.1/8.12.10) id j2NJLi6e021121 for pgsql-jdbc@postgresql.org; Wed, 23 Mar 2005 13:21:44 -0600 Received: from [192.168.0.81] (ppasalalinux.nqadmin.com [192.168.0.81]) by mail.liquidcore.com (8.13.1/8.12.10) with ESMTP id j2NJLiPp021091 for ; Wed, 23 Mar 2005 13:21:44 -0600 Message-ID: <4241C1EC.8090906@nqadmin.com> Date: Wed, 23 Mar 2005 13:22:20 -0600 From: Prasanth Reply-To: dbadmin@nqadmin.com User-Agent: Mozilla Thunderbird 0.9 (X11/20041127) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: moveToCurrentRow causes ArrayIndexOutOfBoundsException Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-scanner: scanned for malicious content X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/181 X-Sequence-Number: 12573 Below is a small sample code that I tried out and the results are a little surprising to me. Is this expected behavior? In the test code below the query would return zero rows. I am using jdk1.5.0 with pg74.215.jdbc3.jar and PostgreSQL 7.4.7 TEST 1: Code Fragment: String sql = "Select * FROM test_table WHERE id = -1;"; Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = st.executeQuery(sql); rs.next(); rs.moveToInsertRow(); rs.updateString("client_name", "XYZ"); rs.moveToCurrentRow(); Causes: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 >= 0 at java.util.Vector.elementAt(Vector.java:432) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.moveToCurrentRow(Abstract Jdbc2ResultSet.java:854) at test.(test.java:35) at test.main(test.java:86) Note: Line number 35 is rs.moveToCurrentRow(); TEST 2: Code Fragment: String sql = "Select * FROM test_table WHERE id = -1;"; Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = st.executeQuery(sql); rs.moveToInsertRow(); rs.updateString("client_name", "XYZ"); rs.moveToCurrentRow(); No Exception.