-
Notifications
You must be signed in to change notification settings - Fork 38.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revisit DatabaseMetadata#getProcedures to only apply fallback if original search yield more than one result #32295
Comments
Thanks for reporting this and sorry the upgrade broke your use case.
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. |
I will create a simple project to illustrate the problem We are using image mcr.microsoft.com/mssql/server:2017 |
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. |
I have created a simple repo that hopefully illustrates our issue, and might help find a soultion 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 |
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 microsoft/mssql-jdbc#2336. I'll see if we can offer an escape hatch for this. |
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. |
Perfect! Kind regards |
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
The text was updated successfully, but these errors were encountered: