From f18af0cfd0fc97ecd43c330cfb4a868f7bbd8ace Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 20 Jan 2025 22:10:36 -0800 Subject: [PATCH] Actually we do want a specific catalog. The Connection will be connected to a particular "database" and we want to restrict the metadata only to things in that database. --- src/main/java/com/samskivert/jdbc/JDBCUtil.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/samskivert/jdbc/JDBCUtil.java b/src/main/java/com/samskivert/jdbc/JDBCUtil.java index 6203adf2..9d5c6176 100644 --- a/src/main/java/com/samskivert/jdbc/JDBCUtil.java +++ b/src/main/java/com/samskivert/jdbc/JDBCUtil.java @@ -315,7 +315,7 @@ public class JDBCUtil throws SQLException { boolean matched = false; - ResultSet rs = conn.getMetaData().getTables(null, null, name, null); + ResultSet rs = conn.getMetaData().getTables(conn.getCatalog(), null, name, null); while (rs.next()) { String tname = rs.getString("TABLE_NAME"); if (name.equals(tname)) { @@ -334,7 +334,7 @@ public class JDBCUtil throws SQLException { boolean matched = false; - ResultSet rs = conn.getMetaData().getColumns(null, null, table, column); + ResultSet rs = conn.getMetaData().getColumns(conn.getCatalog(), null, table, column); while (rs.next()) { String tname = rs.getString("TABLE_NAME"); String cname = rs.getString("COLUMN_NAME"); @@ -356,7 +356,7 @@ public class JDBCUtil throws SQLException { boolean matched = false; - ResultSet rs = conn.getMetaData().getIndexInfo(null, null, table, false, true); + ResultSet rs = conn.getMetaData().getIndexInfo(conn.getCatalog(), null, table, false, true); while (rs.next()) { String tname = rs.getString("TABLE_NAME"); String cname = rs.getString("COLUMN_NAME"); @@ -379,7 +379,7 @@ public class JDBCUtil throws SQLException { boolean matched = false; - ResultSet rs = conn.getMetaData().getPrimaryKeys(null, null, table); + ResultSet rs = conn.getMetaData().getPrimaryKeys(conn.getCatalog(), null, table); while (rs.next()) { String tname = rs.getString("TABLE_NAME"); String cname = rs.getString("COLUMN_NAME"); @@ -397,7 +397,7 @@ public class JDBCUtil String column) throws SQLException { - ResultSet rs = conn.getMetaData().getIndexInfo(null, null, table, false, true); + ResultSet rs = conn.getMetaData().getIndexInfo(conn.getCatalog(), null, table, false, true); while (rs.next()) { String tname = rs.getString("TABLE_NAME"); String cname = rs.getString("COLUMN_NAME"); @@ -631,7 +631,7 @@ public class JDBCUtil protected static ResultSet getColumnMetaData (Connection conn, String table, String column) throws SQLException { - ResultSet rs = conn.getMetaData().getColumns(null, null, table, column); + ResultSet rs = conn.getMetaData().getColumns(conn.getCatalog(), null, table, column); while (rs.next()) { String tname = rs.getString("TABLE_NAME"); String cname = rs.getString("COLUMN_NAME");