Re: ResultSet.getInt problem
| От | Kris Jurka |
|---|---|
| Тема | Re: ResultSet.getInt problem |
| Дата | |
| Msg-id | Pine.BSO.4.63.0602171336040.20250@leary.csoft.net обсуждение исходный текст |
| Ответ на | ResultSet.getInt problem ("Tomás A. Rossi" <tomas@mecon.gov.ar>) |
| Ответы |
Re: ResultSet.getInt problem
|
| Список | 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 по дате отправления: