我正在尝试调用一个存储过程,其一个参数是 MS SQL 的 sqlstruct
类型。我已经传递了 String[] array
但它引发了此异常
WARNING: #{reportingCharts.getGraphValuesOnLocationBasis}: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [{CALL dbo.up_Chart_SelectPersonCountByRankLocation(?,?,?,?,?)}]; SQL state [null]; error code [0]; The conversion from UNKNOWN to UNKNOWN is unsupported.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to UNKNOWN is unsupported.
javax.faces.FacesException: #{reportingCharts.getGraphValuesOnLocationBasis}: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [{CALL dbo.up_Chart_SelectPersonCountByRankLocation(?,?,?,?,?)}]; SQL state [null]; error code [0]; The conversion from UNKNOWN to UNKNOWN is unsupported.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to UNKNOWN is unsupported.
所以我认为它不接受array
作为结构的参数。
不幸的是,我找不到关于如何在java中使用它的示例。
如何我将这个数组/列表传递给这个存储过程?或者 java 中的 c# SqlDbType.Structured
的替代品是什么?
最佳答案
引用Microsoft JDBC Driver Team Blog ,TVP支持的JDBC驱动还没有发布。有一个解决方法:以二进制形式打包值,在服务器上破解它并将其传递给表值函数。对于 JDBC 驱动程序,此参数必须以二进制形式传递。
请参阅this link您将找到 java 的所有 MSsql 数据类型。
关于c# - 如何将结构数据类型从 Java 传递到 MS SQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12615602/