I try to insert a value to an SQL server Numeric field using a prepared statment:
int temp = 5;
type = java.sql.Types.NUMERIC;
System.out.println(temp);
prd.setObject(i+1, temp,type);
But this gives me a "Arithmetic overflow error converting numeric to data type numeric".
I also tried to convert the int to a Number Or inserting it using prd.setInt, but this also doesn’t work.
What is the right way to set a value in a prepared statement, which will be inserted successfuly in an SQL server Numeric field?
It turns out that when you convert String to int, the conversion for some reason doesn’t work when trying to insert to the prepared statement.
that works.
On my initial code i did: Integer.parseInt(String_value) and that for some reason ruined the variable.