This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I'm using the SQL Server JDBC drivers provided by microsoft and right now I've un into a problem getting data from SQL Server where the column is the mssql type "real". I've tried getDouble() and getFloat() but the exception I get says
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type.
Anyone know of a FREE type 4 JDBC driver for SQL Server that knows how to handle reals?
Java EE Evangelist — Author, EJB 3 in Action 2nd Edition — Java Community Process Member
The type number returned is 7 and the type name is "real". As you all know there is no ResultSet.getReal() function and getDouble(), getFloat(), getBigDecimal() all do not work, the SQL exception is thrown.
Joined: Aug 02, 2004
Well, I'm afraid I draw a blank. This is Sun's helpful recommendation:
So you're obviously doing something wrong. You could always check the scale (getScale) and precision (getPrecision) using the ResultSetMetaData to see if the type is somehow too big. Or better still check the database! :roll:
[edited to add line breaks] [ August 26, 2004: Message edited by: Jeanne Boyarsky ]