"The multi-part identifier "sys.schemas.name" could not be bound.
Driver version
12.4.0.jre8
SQL Server version
Microsoft SQL Azure (RTM) - 12.0.2000.8 Feb 2 2024 04:20:23 Copyright (C) 2022 Microsoft Corporation
Problem description
When we use jdbc to connect to the Azure sqlserver, if we invoke the mssql jdbc api SQLServerDatabaseMetaData.getSchemas(), we receive the error The multi-part identifier "sys.schemas.name" could not be bound. I found actually the error is throw when executing the sql packaged in mssql jdbc:
select sys.schemas.name 'TABLE_SCHEM', CASE WHEN sys.schemas.name IN ('dbo', 'guest','INFORMATION_SCHEMA','sys','db_owner', 'db_accessadmin', 'db_securityadmin', 'db_ddladmin' ,'db_backupoperator','db_datareader', 'db_datawriter','db_denydatareader','db_denydatawriter') THEN null ELSE DB_NAME() END 'TABLE_CATALOG' from sys.schemas order by 2, 1
The sql also failed in ssms. I wonder if there is any compatibility issue between mssql jdbc and Azure sql engine?