Hi Ajith,
Firstly, the thing that can affect your output may be one or combination of the following:
the JDBC driver itself that you are using, i.e., MySQL, PostgreSQL, Cloudscape, etc. Or the number of decimal places defined in your table If your column is defined to have two (2) decimal places, say
, then no matter what value you get - you'll always get
N.NN.
Likewise, if your column is defined to have four decimal places, say
, then no matter what value you get - you'll always get
N.NNNN.
But somehow, if you use
, then you'll be able to get a value in
N.NNNN, no matter how many decimal places you've defined in your column.
You may consider the following code for illustration (although there might be some other best solution for your case):
Originally posted by Ajith George:
I was using rs.getDouble() method. But this gives me only 2 decimal places on the result. Which is the best method to be used to retrive 4 decimal places. Thanks in advance.
[ March 29, 2006: Message edited by: Eduardo Dela Rosa ]
[ March 29, 2006: Message edited by: Eduardo Dela Rosa ]