From: | Prasanth <dbadmin(at)nqadmin(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | moveToCurrentRow causes ArrayIndexOutOfBoundsException |
Date: | 2005-03-23 19:22:20 |
Message-ID: | 4241C1EC.8090906@nqadmin.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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.<init>(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.
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2005-03-23 20:00:58 | Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException |
Previous Message | David Gagnon | 2005-03-22 20:26:31 | Re: Is that normal I can't commit a transaction when using |