November 30, 2010 at 3:43 am
Hi,
I have a Java application which receives some data as IEEE 754 single precison (4 byte) values. The application converts these into java Float and stores them in a database. I read the following links and concluded that the database column storing these values should be of type REAL:
http://download.oracle.com/javase/6/docs/technotes/guides/jdbc/getstart/mapping.html
http://msdn.microsoft.com/en-us/library/ms378878.aspx
However, I'm now realizing that though the documentation says that Java float should be mapped to REAL, not all valid Java float values can be stored in SQL Server REAL. For example if I try to store java.lang.Float.MIN_VALUE in a real column, the database complains because apparently, the ranges of Java Float and SQL Server REAL are different.
Interestingly, though, I'm able to store java.lang.Double.MIN_VALUE (4.9E-324) in a FLOAT(53) column even though it does not fall in the range of FLOAT(- 1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308 as per documentation)
My application receives many such values in different columns. Wondering if my only option now is to change the database columns to FLOAT while keeping the Java object types as Float.
November 30, 2010 at 7:28 am
This was removed by the editor as SPAM
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy