views:

87

answers:

0

MSSQL has an interesting JDBC inconsistency. Regarding the parameters on a stored procedure, when you access their names, they are referenced with an @ sign in front of them (the way they are declared in the stored procedure).

When you use a callable statement to set parameters by name, however the Microsoft JDBC driver requires you to leave off the @. jTDS however requires the @sign.

ParameterMetaData does not seem to have a method to know what the valid names on a prepared statement or a callable statement are. Is there a standard JDBC solution which lets you know for a give Callable Statement what the valid parameter names to pass for a method like:

  callableStatement.setString("name", "value");

If there is no standard JDBC way, is there some way specific to MSSQL other than figuring out the name of the driver in use?