From: Roman Chervotkin <roman.chervotkin@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: The column name x was not found in this ResultSet
Date: Wed, 20 Dec 2006 14:35:20 +0300
Message-ID: <c1b06e90612200335g7e58956fn1b20ec06d14feba7@mail.gmail.com> (raw)
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.
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: roman.chervotkin@gmail.com
Subject: Re: The column name x was not found in this ResultSet
In-Reply-To: <c1b06e90612200335g7e58956fn1b20ec06d14feba7@mail.gmail.com>
References: <c1b06e90612200335g7e58956fn1b20ec06d14feba7@mail.gmail.com>
* 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