pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedmoveToCurrentRow causes ArrayIndexOutOfBoundsException
4+ messages / 2 participants
[nested] [flat]
* moveToCurrentRow causes ArrayIndexOutOfBoundsException
@ 2005-03-23 19:22 Prasanth <dbadmin@nqadmin.com>
2005-03-23 20:00 ` Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 4+ messages in thread
From: Prasanth @ 2005-03-23 19:22 UTC (permalink / raw)
To: 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.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException
2005-03-23 19:22 moveToCurrentRow causes ArrayIndexOutOfBoundsException Prasanth <dbadmin@nqadmin.com>
@ 2005-03-23 20:00 ` Kris Jurka <books@ejurka.com>
2005-03-23 20:13 ` Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException Prasanth <dbadmin@nqadmin.com>
0 siblings, 1 reply; 4+ messages in thread
From: Kris Jurka @ 2005-03-23 20:00 UTC (permalink / raw)
To: Prasanth <dbadmin@nqadmin.com>; +Cc: pgsql-jdbc
On Wed, 23 Mar 2005, Prasanth wrote:
> Below is a small sample code that I tried out and the results are a little
> surprising to me. Is this expected behavior?
No, that's a bug. moveToCurrentRow was not correctly handling the
case where the current row is off the end of the ResultSet. I've fixed it
in 8.0 and 8.1dev.
> I am using jdk1.5.0 with pg74.215.jdbc3.jar and PostgreSQL 7.4.7
Your stacktrace shows you are using the 8.0 driver.
I've put up new versions of the 8.0 jar files here:
http://www.ejurka.com/pgsql/jars/prasanth
Kris Jurka
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException
2005-03-23 19:22 moveToCurrentRow causes ArrayIndexOutOfBoundsException Prasanth <dbadmin@nqadmin.com>
2005-03-23 20:00 ` Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException Kris Jurka <books@ejurka.com>
@ 2005-03-23 20:13 ` Prasanth <dbadmin@nqadmin.com>
2005-03-23 20:21 ` Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 4+ messages in thread
From: Prasanth @ 2005-03-23 20:13 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
> Your stacktrace shows you are using the 8.0 driver.
Sorry about that had two jars in my class path.
The other one was postgresql-8.0.309.jdbc3.jar
> No, that's a bug. moveToCurrentRow was not correctly handling the
> case where the current row is off the end of the ResultSet. I've fixed it
> in 8.0 and 8.1dev.
If I am using 8.0 jar then wasn't the fix there?
Any how I tried with the new jar you have provided and seems its working now.
Thank you very much for your help.
-Prasanth.
Kris Jurka wrote:
>
> On Wed, 23 Mar 2005, Prasanth wrote:
>
>
>>Below is a small sample code that I tried out and the results are a little
>>surprising to me. Is this expected behavior?
>
>
> No, that's a bug. moveToCurrentRow was not correctly handling the
> case where the current row is off the end of the ResultSet. I've fixed it
> in 8.0 and 8.1dev.
>
>
>>I am using jdk1.5.0 with pg74.215.jdbc3.jar and PostgreSQL 7.4.7
>
>
> Your stacktrace shows you are using the 8.0 driver.
>
> I've put up new versions of the 8.0 jar files here:
>
> http://www.ejurka.com/pgsql/jars/prasanth
>
> Kris Jurka
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException
2005-03-23 19:22 moveToCurrentRow causes ArrayIndexOutOfBoundsException Prasanth <dbadmin@nqadmin.com>
2005-03-23 20:00 ` Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException Kris Jurka <books@ejurka.com>
2005-03-23 20:13 ` Re: moveToCurrentRow causes ArrayIndexOutOfBoundsException Prasanth <dbadmin@nqadmin.com>
@ 2005-03-23 20:21 ` Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 4+ messages in thread
From: Kris Jurka @ 2005-03-23 20:21 UTC (permalink / raw)
To: Prasanth <dbadmin@nqadmin.com>; +Cc: pgsql-jdbc
On Wed, 23 Mar 2005, Prasanth wrote:
> > No, that's a bug. moveToCurrentRow was not correctly handling the
> > case where the current row is off the end of the ResultSet. I've fixed it
> > in 8.0 and 8.1dev.
>
> If I am using 8.0 jar then wasn't the fix there?
> Any how I tried with the new jar you have provided and seems its working
> now.
>
I meant that I fixed it since receiving your report which is why I built a
current set of jar files for you. The fix is not in the officially
released ones.
Kris Jurka
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2005-03-23 20:21 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-23 19:22 moveToCurrentRow causes ArrayIndexOutOfBoundsException Prasanth <dbadmin@nqadmin.com>
2005-03-23 20:00 ` Kris Jurka <books@ejurka.com>
2005-03-23 20:13 ` Prasanth <dbadmin@nqadmin.com>
2005-03-23 20:21 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox