|
I am using MySQL as my database system. I have one field on the table which has a data type of int(65,0). Upon data retrieval on the java code using prepared statement, I am having loss of data (using the usual getXXXX() method). I have also tried BigDecimal as data type. What could be the best data type to accommodate big number such as this: 21165471430000012335407429034439500044? With a maximum length of 65? Thanks ;) |
|
Just to copy the solution above, the problem arose when OP used This is because the parameter in |
I would've thought that
BigDecimalwould work. What happens when you use BigDecimal?In this case, the value on the database is 21165471430000012335407429034439500044
But when fetched through the result set:
nextOID = result.getBigDecimal("uid_maxid");
I am getting a value of -2147483646
Just to be sure, do you mean "
int(65, 0)" or "numeric(65, 0)" in your column definition?Yes, it was designed as int(65, 0). But I also figured out that I should use numeric(65, 0) on the database field instead, for it to match with BigDecimal data type on the code.
Thanks everyone for answering! :)