1) I have a Sybase database which contains a table say 'TABLE1'. One of the fields say 'X' (which in business terms represents money), has type 'float' in that table. UNFORTUNATELY, I can not change the type of this column because many applications will be affected if I do the same.
2) I am using jconn2.jar in JDBC. I retrieve 'X' by using getDouble()( I read somewhere that the float,double SQL types are best mapped as double 'java data type' ).
3) The value stored in 'X' in the database is '212400000'. When I do a getDouble(int col), I get '212399999.99999997' (in the scientific form). I am loosing precision. I am aware of the fact that there are certain numbers which can not be represented exactly in base 2 and hence we see some incorrect outputs while using double.
4) I have tried getBigDecimal but in vain. I am stuck. Could some one guide me through the same ?
EDIT:- One question which I need to ask is that is there a way where in I can use getDouble() to retrieve a value based on the precision I need say 12,17 etc ? What is the default precision associated with getDouble() ?