Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(jdbc): handle UnsupportedOperationException from Hive-based JDBC drivers

t8y2fdc4214bbb50
diff --git a/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java b/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java
index 665491691f..1d93411b8d 100644
--- a/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java
+++ b/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java
@@ -415,7 +415,7 @@ public final class DbxJdbcPlugin {
try {
try (Statement stmt = conn.createStatement()) {
if (timeoutSecs >= 0) {
- try { stmt.setQueryTimeout(timeoutSecs); } catch (SQLFeatureNotSupportedException ignored) {}
+ try { stmt.setQueryTimeout(timeoutSecs); } catch (SQLFeatureNotSupportedException | UnsupportedOperationException ignored) {}
}
boolean hasResultSet = stmt.execute(trimStatementSql(sql));
if (hasResultSet) {
@@ -492,13 +492,13 @@ public final class DbxJdbcPlugin {
if (fetchSize > 0) {
try {
statement.setFetchSize(fetchSize);
- } catch (SQLFeatureNotSupportedException ignored) {
+ } catch (SQLFeatureNotSupportedException | UnsupportedOperationException ignored) {
}
}
if (timeoutSecs >= 0) {
try {
statement.setQueryTimeout(timeoutSecs);
- } catch (SQLFeatureNotSupportedException ignored) {
+ } catch (SQLFeatureNotSupportedException | UnsupportedOperationException ignored) {
}
}
}
@@ -642,7 +642,7 @@ public final class DbxJdbcPlugin {
if (catalog != null) {
try {
conn.setCatalog(catalog);
- } catch (SQLFeatureNotSupportedException | AbstractMethodError ignored) {
+ } catch (SQLFeatureNotSupportedException | AbstractMethodError | UnsupportedOperationException ignored) {
}
if (driverQuirks(connection).useCatalogFallbackSql()) {
applyUseCatalogFallback(conn, catalog);
@@ -651,7 +651,7 @@ public final class DbxJdbcPlugin {
if (schema != null) {
try {
conn.setSchema(schema);
- } catch (SQLFeatureNotSupportedException | AbstractMethodError ignored) {
+ } catch (SQLFeatureNotSupportedException | AbstractMethodError | UnsupportedOperationException ignored) {
}
}
}
@@ -659,7 +659,7 @@ public final class DbxJdbcPlugin {
private static void applyUseCatalogFallback(Connection conn, String catalog) {
try (Statement statement = conn.createStatement()) {
statement.execute("USE " + quoteJdbcIdentifier(catalog));
- } catch (SQLException | AbstractMethodError ignored) {
+ } catch (SQLException | AbstractMethodError | UnsupportedOperationException ignored) {
}
}
@@ -719,7 +719,7 @@ public final class DbxJdbcPlugin {
addDatabase(result, optionalText(connection, "database"));
try {
addDatabase(result, conn.getCatalog());
- } catch (SQLFeatureNotSupportedException | AbstractMethodError ignored) {
+ } catch (SQLFeatureNotSupportedException | AbstractMethodError | UnsupportedOperationException ignored) {
}
return result;
}
@@ -762,7 +762,7 @@ public final class DbxJdbcPlugin {
} else {
try (ResultSet rs = meta.getSchemas(catalog, null)) {
appendSchemas(result, rs, false);
- } catch (SQLFeatureNotSupportedException ignored) {
+ } catch (SQLFeatureNotSupportedException | UnsupportedOperationException ignored) {
try (ResultSet rs = meta.getSchemas()) {
appendSchemas(result, rs, false);
}
@@ -770,7 +770,7 @@ public final class DbxJdbcPlugin {
if (result.isEmpty() && catalog != null) {
try (ResultSet rs = meta.getSchemas(null, null)) {
appendSchemas(result, rs, false);
- } catch (SQLFeatureNotSupportedException ignored) {
+ } catch (SQLFeatureNotSupportedException | UnsupportedOperationException ignored) {
}
}
}
@@ -780,7 +780,7 @@ public final class DbxJdbcPlugin {
if (schema != null) {
addSchema(result, schema, quirks.caseInsensitiveSchemaMetadata());
}
- } catch (SQLFeatureNotSupportedException | AbstractMethodError ignored) {
+ } catch (SQLFeatureNotSupportedException | AbstractMethodError | UnsupportedOperationException ignored) {
}
}
return result;
@@ -960,7 +960,7 @@ public final class DbxJdbcPlugin {
}
}
return fallback;
- } catch (SQLFeatureNotSupportedException ignored) {
+ } catch (SQLFeatureNotSupportedException | UnsupportedOperationException ignored) {
return null;
}
}
@@ -1043,7 +1043,7 @@ public final class DbxJdbcPlugin {
putNullablePreferValue(columnNode(result, name), "comment", comment);
}
}
- } catch (SQLException | AbstractMethodError ignored) {
+ } catch (SQLException | AbstractMethodError | UnsupportedOperationException ignored) {
}
}