Re: ResultSet.getInt problem - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: ResultSet.getInt problem
Date
Msg-id Pine.BSO.4.63.0602171336040.20250@leary.csoft.net
Whole thread Raw
In response to ResultSet.getInt problem  ("Tomás A. Rossi" <tomas@mecon.gov.ar>)
Responses Re: ResultSet.getInt problem  ("Tomás A. Rossi" <tomas@mecon.gov.ar>)
List pgsql-jdbc

On Fri, 17 Feb 2006, "Tomás A. Rossi" wrote:

> ResultSet rs= con.select(query);
> while (rs.next()) {
>   id= rs.getInt("id");
>   out.println(id); // prints 0 in every row!!
>   name= rs.getString("name"); // ok
>   ...
>
> Now if I change getInt("id") for the other overload getInt(1), it works fine!
> (it prints the correct id for every column)
>

I'm not sure what's going wrong here.  What do you get if you add some
additional debugging code along the lines of the following:

ResultSetMetaData rsmd = rs.getMetaData();
for (int i=1; i<=rsmd.getColumnCount(); i++) {
     System.out.println("["+rsmd.getColumnName()+"]");
}

Kris Jurka

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: setString and timestamps
Next
From: Kris Jurka
Date:
Subject: Re: PGConnectionPoolDataSource is not a DataSource?