pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: "Tomás A. Rossi" <tomas@mecon.gov.ar>
To: pgsql-jdbc@postgresql.org
Subject: ResultSet.getInt problem
Date: Fri, 17 Feb 2006 12:29:13 -0300
Message-ID: <43F5EBC9.30600@mecon.gov.ar> (raw)

Hi,

I'm using PostgreSQL 8.1.2 in a FreeBSD 5.3. Using with JAVA servlet 
application and driver postgresql-8.1-405.jdbc2ee.jar.

I make the query in Java so the DB returns a table something like (I 
passed the query manually to the DB to be sure it was OK):

 id | name | domain | ...
17 | minplan | minplan.gov.ar | ...
  8 | msal | msal.gov.ar | ...
10 | trabajo | trabajo.gov.ar | ...
(3 rows)

Now in Java I get a code like this:

try {
  ResultSet rs= con.select(query);
  while (rs.next()) {
    // I get the results.
    id= rs.getInt("id");
    out.println(id); // prints 0 in every row!!
    name= rs.getString("name"); // ok
    domain= rs.getString("domain"); // ok
    ...

Now if I change getInt("id") for the other overload getInt(1), it works 
fine!
(it prints the correct id for every column)

Thanks in advance,
Tom;




view thread (5+ messages)  latest in thread

Message-ID: <43F5EBC9.30600@mecon.gov.ar>
Permalink:  ../43F5EBC9.30600@mecon.gov.ar/
Also on:    postgresql.org/message-id/43F5EBC9.30600@mecon.gov.ar

 · 

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: tomas@mecon.gov.ar
  Subject: Re: ResultSet.getInt problem
  In-Reply-To: <43F5EBC9.30600@mecon.gov.ar>
  References: <43F5EBC9.30600@mecon.gov.ar>

* 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