【发布时间】:2012-09-27 06:44:47
【问题描述】:
我正在尝试调用一个存储过程,其一个参数是 sqlstructure 类型的 MS SQL。我已通过 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的替代品是什么?
【问题讨论】:
-
我不是 Java 程序员,但也许这会有所帮助:JDBC 具有单独的 ARRAY (java.sql.Array) 和 STRUCT (java.sql.Struct) 数据类型。另一方面 - 我不确定 SQL Server 是否可以接受来自 JDBC 的结构。
标签: c# java sql sql-server jakarta-ee