I have a generic API which accepts a connection. It would seem that one of the callers passes a connection, the prepareCall
of which returns an object of type NewProxyCallableStatement
. The following code then fails:
SQLServerCallableStatement stmt = (SQLServerCallableStatement) connection.prepareCall(sprocSQL);
The full exception seen by the caller of the API is:
java.lang.ClassCastException: com.mchange.v2.c3p0.impl.NewProxyCallableStatement cannot be cast to com.microsoft.sqlserver.jdbc.SQLServerCallableStatement
I need to use SQLServerCallableStatement
because I am calling a stored procedure with an input argument of type TABLE
and SQLServerCallableStatement
has a setStructured
method which allows constructing table type variables.