this is a double post, but in database forum i got no answers so i'm trying my luck here
hey all!
my question is this. i get data from postgresql database. it works fine except for boolean values.
i get values like this
private Vector<Object> getRowData(ResultSet rs, ResultSetMetaData rsMetaData)throws SQLException{
Vector<Object> row = new Vector<Object>();
//
for(int count=1;count<=rsMetaData.getColumnCount();count++){
switch(rsMetaData.getColumnType(count)){
case Types.INTEGER:
case Types.SMALLINT:
case Types.BIGINT:
row.add(rs.getInt(count));
break;
case Types.VARCHAR:
case Types.CHAR:
row.add(rs.getString(count));
break;
case Types.DATE:
row.add(rs.getDate(count));
break;
case Types.BOOLEAN:
row.add(rs.getBoolean(count));
break;
case Types.DOUBLE:
case Types.FLOAT:
row.add(rs.getDouble(count));
break;
}
}
return row;
}
when i try get values like
first name, last name, boolean isEmployee
then i always get array out of bounds exception on the row because the boolean value does not get detected. when i put JOptionPane.showMessageDialog(null,"show value here"); in
Types.VARCHAR
Types.DATE
Types.whatever
it shows the value except of the
Types.BOOLEAN
part of the switch above????
i have done this previously with mysql and it worked fine. the only difference between these two databases is that mysql records booleans as '1' or '0' and postgresql as 't' or 'f'.
is this the possible source of my problems?? and how can this be solved.
if anybody has had similar problem or has something to say about this at all, please, let me know!
thanks
v.v.