Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top