From: | "Tomás A(dot) Rossi" <tomas(at)mecon(dot)gov(dot)ar> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | ResultSet.getInt problem |
Date: | 2006-02-17 15:29:13 |
Message-ID: | 43F5EBC9.30600@mecon.gov.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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;
From | Date | Subject | |
---|---|---|---|
Next Message | Scot P. Floess | 2006-02-17 16:02:55 | unsubscribe |
Previous Message | Jeroen Kransen | 2006-02-17 10:49:37 | PGConnectionPoolDataSource is not a DataSource? |