The column name x was not found in this ResultSet

From: "Roman Chervotkin" <roman(dot)chervotkin(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: The column name x was not found in this ResultSet
Date: 2006-12-20 11:35:20
Message-ID: c1b06e90612200335g7e58956fn1b20ec06d14feba7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello list.

I ve got a problem retrieving value from resultset. I have got
"org.postgresql.util.PSQLException: The column name label was not found in
this ResultSet."

I use 8.2 + 8.2-504 JDBC 3 (also tried 8.2-504 JDBC 4) + jse 1.6

So the query(It works in psql):
-----
"SELECT cand_lang.id, cand_lang.cand_id, cand_lang.lang_id,
cand_lang.level_id, cand_lang.level_spoken, cand_lang.level_written,
cand_lang.native_language, s_languages.name, s_lang_levels.proficiency AS
label, s.proficiency AS label_s, w.proficiency AS label_w
FROM cand_lang
LEFT OUTER JOIN s_languages
ON cand_lang.lang_id = s_languages.id
LEFT OUTER JOIN s_lang_levels
ON cand_lang.level_id = s_lang_levels.id
LEFT OUTER JOIN s_lang_levels AS s
ON cand_lang.level_spoken = s.id
LEFT OUTER JOIN s_lang_levels AS w ON cand_lang.level_written = w.id
WHERE cand_lang.id = ?"

java code:
---
CandidateLanguage result = new CandidateLanguage();
result.setID(new Integer(rs.getInt("id")));
result.setCandidateID(new Integer(rs.getInt("cand_id")));
result.getLanguage().setValue(new Integer(rs.getInt("lang_id")));
result.getLevel().setValue(new Integer(rs.getInt("level_id")));
result.getLevelSpoken().setValue(new Integer(rs.getInt("level_spoken")));
result.getLevelWritten().setValue(new Integer(rs.getInt("level_written")));
result.setNativeLanguage(rs.getBoolean("native_language"));
result.getLanguage().setLabel(rs.getString("name"));
result.getLevel().setLabel(rs.getString("label"));
result.getLevelSpoken().setLabel(rs.getString("label_s"));
result.getLevelWritten().setLabel(rs.getString("label_w"));
---

Why?

Thanks in advance.

Browse pgsql-jdbc by date

  From Date Subject
Next Message Morten Andersen 2006-12-20 12:15:56 Unexpected NullPointerException in "processDeadParsedQueries()" - suggested fix
Previous Message Dave Cramer 2006-12-19 11:09:47 Re: Efficient Insert statement for one record into multiple