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(phoenix): accept legacy direct client jars on manual classpath

t8y27e3db26108ef
diff --git a/apps/desktop/src/lib/database/phoenixConnection.ts b/apps/desktop/src/lib/database/phoenixConnection.ts
index 2a078d4f42..f28b7a5ec1 100644
--- a/apps/desktop/src/lib/database/phoenixConnection.ts
+++ b/apps/desktop/src/lib/database/phoenixConnection.ts
@@ -63,8 +63,13 @@ export function phoenixConnectionModeForConfig(config: PhoenixConnectionConfig):
return connectionString.startsWith("jdbc:phoenix:thin:") || driverClass === PHOENIX_QUERY_SERVER_JDBC_DRIVER_CLASS.toLowerCase() ? "query-server" : "direct";
}
+const PHOENIX_DIRECT_RUNTIME_FILE = /^phoenix-client-(?:embedded-)?hbase-.+\.jar$/i;
+const PHOENIX_LEGACY_DIRECT_RUNTIME_FILE = /^phoenix-.+-HBase-.+-client\.jar$/i;
+const PHOENIX_LEGACY_THIN_CLIENT_FILE = /-thin-client\.jar$/i;
+
export function isPhoenixRuntimePath(path: string, mode: PhoenixConnectionMode): boolean {
const parts = path.split(/[/\\]/);
const fileName = parts[parts.length - 1] || path;
- return mode === "direct" ? /^phoenix-client-(?:embedded-)?hbase-.+\.jar$/i.test(fileName) : /^phoenix-queryserver-client-.+\.jar$/i.test(fileName);
+ if (mode === "query-server") return /^phoenix-queryserver-client-.+\.jar$/i.test(fileName);
+ return PHOENIX_DIRECT_RUNTIME_FILE.test(fileName) || (PHOENIX_LEGACY_DIRECT_RUNTIME_FILE.test(fileName) && !PHOENIX_LEGACY_THIN_CLIENT_FILE.test(fileName));
}
diff --git a/packages/app-tests/phoenixConnection.test.ts b/packages/app-tests/phoenixConnection.test.ts
index e31cbe3978..11b5ed4cd3 100644
--- a/packages/app-tests/phoenixConnection.test.ts
+++ b/packages/app-tests/phoenixConnection.test.ts
@@ -162,6 +162,26 @@ test("defines mode-specific Phoenix Maven runtimes", () => {
assert.equal(jdbcProductRuntimeSelectionId(PHOENIX_JDBC_PRODUCT_PROFILE, "direct"), "phoenix:direct");
});
+test("accepts legacy distribution Phoenix Direct client jar names", () => {
+ assert.equal(isPhoenixRuntimePath("D:\\apps\\DBX\\plugins\\jdbc\\drivers\\phoenix-5.0.0-HBase-2.0-client.jar", "direct"), true);
+ assert.equal(isPhoenixRuntimePath("/opt/phoenix-4.14.3-HBase-1.3-client.jar", "direct"), true);
+ assert.equal(isPhoenixRuntimePath("/opt/PHOENIX-5.1.3-hbase-2.4-CLIENT.JAR", "direct"), true);
+ assert.equal(isPhoenixRuntimePath("/opt/phoenix-5.0.0-HBase-2.0-thin-client.jar", "direct"), false);
+ assert.equal(isPhoenixRuntimePath("/opt/phoenix-5.0.0-HBase-2.0-server.jar", "direct"), false);
+ assert.equal(isPhoenixRuntimePath("/opt/phoenix-5.0.0-HBase-2.0-client.jar", "query-server"), false);
+});
+
+test("keeps a manually selected legacy Phoenix Direct client runtime", async () => {
+ const config = phoenixConfig();
+ config.jdbc_driver_paths = ["D:\\apps\\DBX\\plugins\\jdbc\\drivers\\phoenix-5.0.0-HBase-2.0-client.jar", "D:\\hbase\\conf"];
+ const runtime = runtimeApi();
+
+ const result = await ensureJdbcProductRuntimeDrivers(PHOENIX_JDBC_PRODUCT_PROFILE, config, runtime.api);
+
+ assert.deepEqual(result?.paths, config.jdbc_driver_paths);
+ assert.equal(result?.runtimeSelectionId, undefined);
+});
+
test("builds one complete selector runtime for each installed Phoenix mode", () => {
const direct = mavenBundle(PHOENIX_DIRECT_MAVEN_COORDINATE);
const logging = mavenBundle(PHOENIX_DIRECT_LOGGING_MAVEN_COORDINATE);