I think this test is too conservative. If the statement has more parameter types than the client specified, then the client does not care and we are still okay. The code below checks up to the count given by the client, which should be all that's needed. In particular, in the case of a non-JDBC client that never specifies parameter types, the types will always come from the types system.