Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#644 updateNull not working with MSSQL DECIMAL field

open
Other (154)
5
2012-08-15
2011-03-24
Michele G.
No

When I try to use the updateNull() method on a MSSQL DECIMAL field I get the following SQLException:

java.sql.SQLException: Column or parameter #2: Specified column precision 38 is greater than the maximum precision of 28.

Following is a piece of code that reproduce the problem:

Statement stm = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
stm.executeUpdate("CREATE TABLE test_table(id INTEGER NOT NULL, field DECIMAL(10,2) NULL)");
ResultSet res = stm.executeQuery("SELECT * FROM test_table");
res.moveToInsertRow();
res.updateInt("id", 1);
res.updateNull("field");
res.insertRow();
res.close();

Tested on MSSQL Server 7.0 with jTDS 1.2.2. Same results with jTDS 1.2.5.

Note: The error happen not only on the insert row but also when I try to update an already existing row.

Discussion