I'm using spring-jdbc 5.1.14.RELEASE and MariaDB 10.3.13. When I use SimpleJdbcInsert I'm getting the error:

"Thrown org.springframework.dao.DataAccessResourceFailureException",
        "Unable to locate table meta-data for 'table' in the 'schema' schema"

I can workaround it by adding backticks (`) in the table names, but I don't think I should have to do that.

Thank you for your time.

Comment From: anilkumarkatta204

Hi @dsgoers ,

We tried to recreate the scenario in my local vm with below environment and We don't see any error and application ran without and problem.

Environment: Java 8 Spring JDBC 5.4.14.RELEASE MariaDB 10.3.13

https://github.com/anilkumarkatta204/spring-issue-25388.git

Please refer above source code and if that test case is valid.

Thanks & Regards, -Anil

Comment From: dsgoers

Hi. Thanks for looking into it. I was looking into it a little more and found some more info. The issue appears at GenericTableMetaDataProvider, specifically this line: https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java#L321.

MariaDbDatabaseMetaData.getTables() returns null for TABLE_SCHEM. thus triggering the error I originally posted here https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java#L356.

Adding back ticks wasn't the solution we really needed. Doing so caused the operation to short-circuit at this line: https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java#L342. The correct work-around was to disable the metadata processing entirely using .withoutTableColumnMetaDataAccess().

All that to say, the root issue seems to be in MariaDbDatabaseMetaData. Does your example return a not-null value for TABLE_SCHEM?

Comment From: snicoll

@dsgoers unfortunately those links no longer point to the relevant code as it has changed since then. Can you please share a small sample that we can run ourselves that reproduces this?

You can attach a zip to this issue or push the code to a separate GitHub repository.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Comment From: sbrannen

  • duplicate of #13874