Affects: \spring-jdbc 6.1.2


Upgrade from spring-jdbc 6.1.1 to 6.1.2 does not support schema name with underscore, ie 'schema_name'. When execute procedure call.

SimpleJdbcCall(dataSource) .withSchemaName("schema_name") .withFunctionName("updateName") .declareParameters( SqlParameter("id", Types.VARCHAR), SqlParameter("name", Types.VARCHAR)) .execute(MapSqlParameterSource(mapOf("id" to id, "name" to newName))) Exception thrown org.springframework.dao.InvalidDataAccessApiUsageException: Required input parameter 'RETURN_VALUE' is missing

Comment From: jhoeller

@snicoll is this possibly a regression caused by #22725?

Comment From: snicoll

Thanks for reporting this and sorry the upgrade broke your use case.

Upgrade from spring-jdbc 6.1.1 to 6.1.2 does not support schema name with underscore, ie 'schema_name'. When execute procedure call.

_ is a special character that means "any character". The related issue that Juergen shared made sure that those special characters are escaped so that the search is against _ and not any character.

It looks like that doesn't work for you but we can't really know why. What database is this? Can you share a small sample we can run ourselves to reproduce the problem as it may be specific to your environment. You can attach a zip here or push the code to a GitHub repository.

Comment From: audunmeltzer

I will create a simple project to illustrate the problem

We are using image mcr.microsoft.com/mssql/server:2017

Comment From: snicoll

Thanks very much. Since you mention an image, adding a Docker compose or similar to setup the database in the sample will be very much appreciated as I suspect this might be key to the issue here.

Comment From: audunmeltzer

I have created a simple repo that hopefully illustrates our issue, and might help find a soultion https://github.com/ks-no/spring-jdbc-demo

As described in readme file, I have created different branches witch combines test with different spring-boot versions and schema name with and without underscore '_'. There is one test that calls a procedure that will run or fail on different branches

Comment From: snicoll

I've managed to reproduce the problem. @audunmeltzer FYI, the sample made it extra hard as I couldn't find a way to run your test in IntelliJ IDEA. I managed by using "run all tests under package" option.

This seems to be a bug in the JDBC driver that you're using. I've opened https://github.com/microsoft/mssql-jdbc/issues/2336. I'll see if we can offer an escape hatch for this.

Comment From: snicoll

I've made the fix for the original issue a bit more lenient, with the exact same call as before and a fallback on escaping only if more than one procedures/functions are found. This should prevent the fallback from happening from the vast majority of cases and account for drivers that do not handle escaping consistently.

Comment From: audunmeltzer

Perfect! Thank you so much for your time and help

Kind regards Audun