• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Double, Float

 
Manuel Paco
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using MSAccess database 2002 and I have a column of type double but my code in Java does not seem to recognize Types.FLOAT and DOUBLE from database when I try to read it into vector.
Any idea what I am doing wrong?
Types.LONGVARCHAR, VARCHAR, INTEGER work fine.
Thank you.
for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
switch( rsmd.getColumnType( i ) ) {
case Types.LONGVARCHAR:
currentRow.addElement( "" + rs.getString( i ) );
break;
caseTypes.VARCHAR:
currentRow.addElement( "" + rs.getString( i ) );
break;
case Types.INTEGER:
currentRow.addElement(new Long( rs.getLong(i) ) );
break;
case Types.FLOAT:
currentRow.addElement(new Float(rs.getFloat(i)));
break;
caseTypes.DOUBLE:
currentRow.addElement(new Double(rs.getDoubl(i)));
break;
}
 
Michael Zalewski
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you executing the branch of the case statement for Types.FLOAT and Types.DOUBLE? I bet its because the driver translated the column type to something else (Types.NUMBER?)
Use ResultSetMetaData to see what the actual type of the column is.
 
Manuel Paco
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic