-
Notifications
You must be signed in to change notification settings - Fork 453
Open
Labels
Under InvestigationUsed for issues under investigationUsed for issues under investigation
Description
Driver version
13.2.1.jre11
SQL Server version
Microsoft SQL Server 2022 (RTM-CU17) (KB5048038) - 16.0.4175.1 (X64)
Dec 13 2024 09:01:53
Copyright (C) 2022 Microsoft Corporation
Express Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)
Client Operating System
Microsoft Windows 11 Enterprise
JAVA/JVM version
17
Table schema
dbo
Problem description
When there are multiple databases/catalogs, connection.getMetaData().getSchemas(connection.getCatalog(), "dbo") and connection.getMetaData().getSchemas(null, "dbo") return only one dbo with a null TABLE_CATALOG.
String[] catalogs = new String[]{connection.getCatalog(), null};
for (String catalog: catalogs) {
System.out.println("catalog: " + catalog + "\n");
try (ResultSet rs = connection.getMetaData().getSchemas(catalog, "dbo")) {
int rows = 0;
while (rs.next()) {
for (int col = 1; col <= rs.getMetaData().getColumnCount(); col++) {
System.out.println(String.format("%d. %s : \"%s\"",
col, rs.getMetaData().getColumnName(col), rs.getString(col)
));
}
System.out.println();
rows++;
}
System.out.println("Found " + rows + " row(s).\n");
}
}Expected behavior
- Schema
dboshould have a non-empty catalog. - There should be a
dboschema for every catalog.
Actual behavior
(When there are multiple databases/catalogs each with a dbo schema)
catalog: TestDb
1. TABLE_SCHEM : "dbo"
2. TABLE_CATALOG : "null"
Found 1 row(s).
catalog: null
1. TABLE_SCHEM : "dbo"
2. TABLE_CATALOG : "null"
Found 1 row(s).
Metadata
Metadata
Assignees
Labels
Under InvestigationUsed for issues under investigationUsed for issues under investigation