According to javadoc:

void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
Sets the designated parameter to the given java.math.BigDecimal value. The driver converts this to an SQL NUMERIC value when it sends it to the database.

I've some mssql stored procedure, that have in parameter of type NUMERIC(10, 0) and I try to pass this value as java.math.BigDecimal in JDBC ... But I got:

com.microsoft.sqlserver.jdbc.SQLServerException: Error converting data type decimal to numeric

I do can found workarounds (ex. change the parameter type to BIGING and use setLong from Java)..

But My question is... is this bug in sql server jdbc driver?

有帮助吗?

解决方案

java.lang.Long might fit well here, however I think this is an issue in the mssql driver.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top