Hi Daan Heuvelbeuk,
First of all, a warm welcome to CodeRanch!
Daan Heuvelbeuk wrote:Am I missing something obvious?
You probably are!
Daan Heuvelbeuk wrote:And that does not compute. 'per_id' is the first column name of the account table.
Daan Heuvelbeuk wrote:'greaper' is content for the third column.
That's true for the database table, but not for the result set you are extracting the results from.
You use the following query
So in the column list the columns
per_id and
perident do not appear, so these columns won't appear in the result set. And trying to get values for these columns will (as you discovered yourself) in an exception being thrown. If you use an index, you get the value from the column with that index in the result set (not in the database). So
resultSet.getInt(1) will get you the value for
per_number (not
per_id). Remember that indexes in a ResultSet are 1-based (and not 0-based).
Change your query to
and the
map method will work flawlessly using the column names (if you use appropriate getXxx methods according to the database column types).
Hope it helps!
Kind regards,
Roel