pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: "Tomás A. Rossi" <tomas@mecon.gov.ar>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ResultSet.getInt problem
Date: Fri, 17 Feb 2006 13:39:35 -0500 (EST)
Message-ID: <Pine.BSO.4.63.0602171336040.20250@leary.csoft.net> (raw)
In-Reply-To: <43F5EBC9.30600@mecon.gov.ar>
References: <43F5EBC9.30600@mecon.gov.ar>



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



view thread (5+ messages)  latest in thread

Message-ID: <Pine.BSO.4.63.0602171336040.20250@leary.csoft.net>
Permalink:  ../Pine.BSO.4.63.0602171336040.20250@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.63.0602171336040.20250@leary.csoft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, tomas@mecon.gov.ar
  Subject: Re: ResultSet.getInt problem
  In-Reply-To: <Pine.BSO.4.63.0602171336040.20250@leary.csoft.net>
  References: <43F5EBC9.30600@mecon.gov.ar> <Pine.BSO.4.63.0602171336040.20250@leary.csoft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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