This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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
Joined: Apr 23, 2002
Posts: 168
posted
0
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.