0

I am trying to call a stored procedure whose one parameter is sqlstructure type of MS SQL.I have passed String[] array but it threw this exception

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.

So I think it is not accepting the array as a parameter for structure.
Unfortunately nowhere I can find an example about how to use it in java.
How can i pass my this array/list to this stored procedure? OR what would be the alternate for c# SqlDbType.Structured in java?

2
  • 1
    Im not Java programmer, but maybe this will help: JDBC has separate ARRAY (java.sql.Array) and STRUCT (java.sql.Struct) data types. From the other side - im not sure that SQL Server can accept structures from JDBC. Commented Sep 27, 2012 at 7:07
  • possible duplicate of stackoverflow.com/questions/9375553/… Commented Oct 19, 2012 at 4:38

1 Answer 1

1

Refer to Microsoft JDBC Driver Team Blog , the JDBC driver supported by TVP has not been released yet. There is a workaround :packing the values in a binary form ,cracking it on the server and passing it to a table valued function. For JDBC driver this argument has to be passed as binary.
See this link you will find all the MSsql datatypes for java.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.