Thread: The column name x was not found in this ResultSet
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.
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.