Use runPrepUpdate
, and assemble a query string with the right number of literal ?
placeholders in the outgoing query for the number of values you expect to send. Note that MSSQL has a hardcoded, arbitrary limit on the number of parameters you can send via JDBC; I want to remember it as somewhere between 1-2 thousand.
If you're doing anything that requires formatting a datetime to a string, you've already lost.
runPrepUpdate
sends a JDBC PreparedStatement, which slots in native Java objects as query parameters; thus you can losslessly send a java.util.Date
in and the JDBC driver will handle marshalling that Java type into the appropriate binary format to send into your DB.