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): detect iris jdbc dialect

t8y2dbb391538080
diff --git a/apps/desktop/src/lib/__tests__/jdbcDialect.spec.ts b/apps/desktop/src/lib/__tests__/jdbcDialect.spec.ts
new file mode 100644
index 0000000000..1adbc98498
--- /dev/null
+++ b/apps/desktop/src/lib/__tests__/jdbcDialect.spec.ts
@@ -0,0 +1,40 @@
+import { describe, expect, it } from "vitest";
+import { effectiveDatabaseTypeForConnection, inferJdbcDialect } from "@/lib/jdbcDialect";
+
+describe("jdbc dialect inference", () => {
+ it("detects InterSystems IRIS and Caché JDBC connections", () => {
+ expect(
+ inferJdbcDialect({
+ db_type: "jdbc",
+ connection_string: "jdbc:IRIS://localhost:1972/USER",
+ }),
+ ).toBe("iris");
+ expect(
+ inferJdbcDialect({
+ db_type: "jdbc",
+ connection_string: "jdbc:Cache://localhost:1972/USER",
+ }),
+ ).toBe("iris");
+ expect(
+ inferJdbcDialect({
+ db_type: "jdbc",
+ jdbc_driver_class: "com.intersystems.jdbc.IRISDriver",
+ }),
+ ).toBe("iris");
+ expect(
+ inferJdbcDialect({
+ db_type: "jdbc",
+ jdbc_driver_paths: ["/drivers/intersystems-jdbc-3.10.5.jar"],
+ }),
+ ).toBe("iris");
+ });
+
+ it("uses IRIS table preview dialect for generic JDBC IRIS connections", () => {
+ expect(
+ effectiveDatabaseTypeForConnection({
+ db_type: "jdbc",
+ connection_string: "jdbc:IRIS://localhost:1972/USER",
+ }),
+ ).toBe("iris");
+ });
+});
diff --git a/apps/desktop/src/lib/jdbcDialect.ts b/apps/desktop/src/lib/jdbcDialect.ts
index ace47499be..a7b5b74485 100644
--- a/apps/desktop/src/lib/jdbcDialect.ts
+++ b/apps/desktop/src/lib/jdbcDialect.ts
@@ -18,6 +18,7 @@ const JDBC_DIALECT_MATCHERS: Array<{ type: DatabaseType; patterns: RegExp[] }> =
{ type: "sqlite", patterns: [/jdbc:sqlite:/i, /sqlite/i] },
{ type: "db2", patterns: [/jdbc:db2:/i, /\bdb2\b/i] },
{ type: "informix", patterns: [/jdbc:informix/i, /informix/i] },
+ { type: "iris", patterns: [/jdbc:(?:iris|cache):/i, /com\.intersystems\.jdbc\.(?:IRIS|Cache)Driver/i, /intersystems-jdbc/i] },
];
export function inferJdbcDialect(connection?: JdbcDialectConnection): DatabaseType | undefined {