Search code examples
javamysqldatabasestruts2bigdecimal

Arithmetic overflow error converting float to data type numeric


I have a column in MySQL db and its data type is decimal(6,6). Now in order to store data in that column what data type i should take in Java? Now I tried using double, float, and BigDecimal, nothing works for me?


Solution

  • According to the MySQL official reference (Connector/J JDBC Reference) the DECIMAL type is mapped to java.math.BigDecimal. Also see the 25.4.4.3. Java, JDBC and MySQL Types.