org.postgresql.util.PSQLException Column name candidates.id wasn't found in the ResultSet

Поиск
Список
Период
Сортировка
Искать

org.postgresql.util.PSQLException Column name candidates.id wasn't found in the ResultSet

От:
Roman Chervotkin <roman.chervotkin@gmail.com>
Дата:
Hi, there.
May be silly question but I can't understand it.

I have query in my application "SELECT * FROM candidates WHERE candidates.id=?"

so after query executed I've got exception
 Exception Details: org.postgresql.util.PSQLException
  Der Spaltenname candidates.id wurde in diesem ResultSet nicht gefunden,

But if remove tablename from query and just leave column name like this
"SELECT * FROM candidates WHERE id=?" query executed without a problem. But from phpmyadmin both these queries worked.
I tried this for two tables and get the same results.

I'm using Postgresql 8.1 with postgresql-8.1-404.jdbc3.jar

Thanks,
Roman.

Re: org.postgresql.util.PSQLException Column name candidates.id

От:
Kris Jurka <books@ejurka.com>
Дата:


On Thu, 24 Nov 2005, Roman Chervotkin wrote:

> I have query in my application "SELECT * FROM candidates WHERE
> candidates.id=?"
>
> so after query executed I've got exception
> *Exception Details: * org.postgresql.util.PSQLException
>  Der Spaltenname candidates.id wurde in diesem ResultSet nicht gefunden,
>

This error is complaining about calling ResultSet.getXXX("candidates.id"), 
not the execution of the query.  You need to call getXXX("id"), you may 
not qualify resulting column with the source tablename.

Kris Jurka
FAQ