getXXX throws SQLException while on insert row

From: Prasanth Reddy <dbadmin(at)nqadmin(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: getXXX throws SQLException while on insert row
Date: 2007-10-29 19:44:58
Message-ID: 4726383A.8060909@nqadmin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

Should the below code throw an SQLException?

rs.moveToInsertRow();
rs.updateInt("account_id", 1023);
rs.getInt("account_id"); - shouldn't this return 1023 rather than
throwing SQLException?

Below is the exception:
org.postgresql.util.PSQLException: ResultSet not positioned properly,
perhaps you need to call next.
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkResultSet(AbstractJdbc2ResultSet.java:2473)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1903)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getFixedString(AbstractJdbc2ResultSet.java:2404)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2012)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2226)

Postgres Server version: 8.1
JDBC Driver version: 8.1-410 JDBC 3

Thanks,
-Prasanth.
<http://jdbc.postgresql.org/download/postgresql-8.1-410.jdbc3.jar>

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Marek Lewczuk 2007-10-30 09:02:09 Re: AbstractJdbc2Array - another patch
Previous Message cncinfo@126.com 2007-10-29 03:29:23 Re: about function overload,a bug?