0

I am trying to modify an existing legacy application by porting few queries and making them compatible with MSSQL server. Some part is already written and I am actually integrating TVP with Java code.

But when I try to execute my code I get a weird exception

java.lang.ClassCastException:
com.microsoft.sqlserver.jdbc.SQLServerCallableStatement cannot be cast to com.microsoft.sqlserver.jdbc.SQLServerCallableStatement

This is the code I have written. MY_NUMBER is actually a Table type.

CallableStatement stmt = ((WrappedCallableStatementJDK7) cstmt).getUnderlyingStatement();
        SQLServerDataTable tbl = new SQLServerDataTable();
        tbl.addColumnMetadata("key", Types.INTEGER);
        tbl.addColumnMetadata("value", Types.INTEGER);
        tbl.addRow(0, 0);
        SQLServerCallableStatement statement = (SQLServerCallableStatement) stmt;
        statement.setStructured(thisPSParamObj.getParameterName(), "DBO.MY_NUMBER", tbl);
Dale K
  • 25,246
  • 15
  • 42
  • 71
Anand Vaidya
  • 1,374
  • 11
  • 26
  • I am suspecting it is a classpath issue. If somebody could point me towards setting right classpath in wildfly, It would be really great! – Anand Vaidya Feb 20 '19 at 19:15
  • 1
    Check if you have two different versions of driver jars (one in the modules and one in the application). – Atul Feb 20 '19 at 20:22

0 Answers0