feat(iotdb): add Apache IoTDB support

This commit is contained in:
t8y2
2026-06-07 10:29:05 +08:00
parent 2b2d789c2c
commit a3e45cd721
21 changed files with 201 additions and 3 deletions
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="Õ_xBA__x2264__x201E__1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 107.7 107.7"
style="enable-background:new 0 0 107.7 107.7;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#9E2878;}
</style>
<g>
<g id="g1133" transform="translate(-244.51235,-228.78793)">
<path id="path1119" class="st0" d="M340.8,253.8c2.6-1,5.5,0.4,6.2,3c0.7,2.6-1.1,5.7-3.7,6.4c-3.2,0.6-6.2-1.4-9.3,0.2
c-3.1,1.7-4,5.2-4.7,8.3c-1.4,5-8.5,7.3-12.1,4.2c-3.3-2.4-3.4-7.8-0.2-11c2.2-2.5,5.9-3.3,8.8-2c2.7,1.2,6,1.7,8.6-0.4
C337.5,260.1,336.7,255.1,340.8,253.8L340.8,253.8z"/>
<path id="path1121" class="st0" d="M280.5,244.7c4.2-2.2,9.5,1.5,8.2,6.1c-1.4,5.4-0.7,11.5,2.9,15.5c3.4,4,9.8,4.8,14.6,1.9
c3.7-2.1,6-5.8,7.4-9.6c1-3.1,0.6-6.2,1.1-9.3c1-3.8,5.8-6,9.1-4.2c3.2,1.4,4,5.9,1.7,8.8c-1.4,2.2-4.2,2.7-6.3,3.8
c-3.6,1.9-6.5,4.9-8.4,8.6c-1.2,2.1-1.1,4.5-1.7,6.7c-0.9,1.9-3,2.7-4.8,2.9c-4.8,0.6-9.5,3-13,6.7c-1.7,1.7-3.1,4.2-5.6,4.2
c-2.7-0.2-4.7-2.6-7.4-2.7c-4.9-0.7-10.2,0.7-14.4,4c-3.7,3.1-9.4,0.8-9.6-3.7c-0.9-5.1,6.2-9.5,10.1-6.2c4.3,4,10.8,5.6,16.9,3.7
c5.6-1.9,9.7-8.3,8.6-14c-0.9-4.9-4.2-9.3-8.6-11.4c-1.7-0.8-3.6-1.6-4.2-3.5C275.6,250.2,277.3,246.2,280.5,244.7L280.5,244.7z"
/>
<path id="path1123" class="st0" d="M277.8,235.9c2.2-0.8,4.2,1.3,3.3,3.4c-0.6,2.1-3.7,2.7-4.8,1.1
C275,238.9,276,236.4,277.8,235.9z"/>
<path id="path1125" class="st0" d="M246.9,278.8c2.2-0.8,4.2,1.2,3.3,3.4c-0.6,2.1-3.7,2.7-4.8,1C244,281.9,245,279.3,246.9,278.8
L246.9,278.8z"/>
<path id="path1127" class="st0" d="M328.2,236.2c2.2-0.7,4.2,1.3,3.3,3.5c-0.6,2-3.7,2.7-4.8,1
C325.4,239.2,326.3,236.8,328.2,236.2z"/>
<path id="path1129" class="st0" d="M253.6,257.7c0.4-3.7,5.5-5.9,8.1-3.6c1.9,1.1,1.6,3.6,2.2,5.4c0.4,2.4,2.7,4.3,5.2,4.3
c3.2,0.3,6.4-2.3,9.5-1.2c4.8,1.2,6.5,7.5,3.2,11.5c-2.9,4.1-9.3,4.5-12,0.7c-2.4-2.8-0.5-7.1-2.7-10.1c-1.7-2.9-5.4-2.7-8.3-1.9
C255.8,263.8,253,260.7,253.6,257.7L253.6,257.7z"/>
<path id="path1131" class="st0" d="M300.8,230c3.3-1.9,7.5,0.9,6.7,4.6c0,2.3-2.2,3.6-3.5,5.2c-1.9,1.9-2.3,4.9-1.2,7
c1.3,2.9,4.9,4,5.5,7.2c1.2,4.8-3.3,10.1-8.2,9.8c-4.8,0.1-8.3-5-6.3-9.5c1.2-3.8,5.8-4.9,7.2-8.5c1.7-3.2-0.4-6.1-2.4-8.1
C296.7,235.6,297.9,231.4,300.8,230z"/>
</g>
<g id="g1149" transform="translate(-244.51235,-228.78793)">
<path id="path1135" class="st0" d="M256,311.5c-2.6,1-5.5-0.4-6.2-3c-0.7-2.6,1.1-5.7,3.7-6.4c3.2-0.6,6.2,1.4,9.3-0.2
c3.1-1.6,4-5.1,4.7-8.2c1.4-5,8.5-7.3,12.1-4.2c3.3,2.4,3.4,7.8,0.2,10.9c-2.2,2.5-5.9,3.3-8.8,2c-2.7-1.2-6-1.7-8.6,0.4
C259.1,305,259.9,310.2,256,311.5L256,311.5z"/>
<path id="path1137" class="st0" d="M316.1,320.5c-4.2,2.2-9.5-1.5-8.2-6c1.4-5.4,0.7-11.6-2.9-15.6c-3.4-4-9.8-4.7-14.6-1.9
c-3.7,2-6,5.7-7.4,9.5c-1,3.1-0.6,6.2-1.1,9.3c-1,3.8-5.8,6-9.1,4.3c-3.2-1.4-4-5.9-1.7-8.9c1.4-2.2,4.2-2.7,6.3-3.8
c3.6-1.9,6.5-4.9,8.4-8.6c1.2-2,1.1-4.5,1.7-6.6c0.9-1.9,3-2.7,4.8-2.9c4.8-0.6,9.5-3,13-6.7c1.7-1.6,3.1-4.2,5.6-4.1
c2.7,0.1,4.7,2.5,7.4,2.7c4.9,0.6,10.2-0.8,14.4-4c3.7-3.2,9.4-0.9,9.6,3.6c0.9,5.1-6.2,9.5-10.1,6.2c-4.3-4-10.8-5.6-16.9-3.7
c-5.6,1.9-9.7,8.3-8.6,14c0.9,4.8,4.2,9.3,8.6,11.3c1.7,0.8,3.6,1.6,4.2,3.5C321.2,314.9,319.4,319.1,316.1,320.5L316.1,320.5z"/>
<path id="path1139" class="st0" d="M318.9,329.4c-2.2,0.8-4.2-1.3-3.3-3.4c0.6-2.1,3.7-2.7,4.8-1.1
C321.7,326.3,320.7,328.8,318.9,329.4z"/>
<path id="path1141" class="st0" d="M349.9,286.5c-2.2,0.7-4.2-1.3-3.3-3.5c0.6-2.1,3.7-2.7,4.8-1
C352.8,283.5,351.8,285.9,349.9,286.5z"/>
<path id="path1143" class="st0" d="M268.5,329c-2.2,0.7-4.2-1.3-3.3-3.5c0.6-2,3.7-2.7,4.8-1C271.3,325.9,270.3,328.5,268.5,329z"
/>
<path id="path1145" class="st0" d="M343.1,307.4c-0.4,3.7-5.5,5.9-8.1,3.6c-1.9-1.1-1.6-3.6-2.2-5.4c-0.4-2.4-2.7-4.3-5.2-4.3
c-3.2-0.3-6.4,2.3-9.5,1.2c-4.8-1.2-6.5-7.5-3.2-11.5c2.9-4.1,9.3-4.5,12-0.7c2.4,2.8,0.5,7,2.7,10c1.7,2.9,5.4,2.7,8.3,1.9
C341,301.4,343.8,304.4,343.1,307.4L343.1,307.4z"/>
<path id="path1147" class="st0" d="M295.8,335.2c-3.3,2-7.5-0.9-6.7-4.6c0-2.3,2.2-3.6,3.5-5.2c1.9-1.9,2.3-4.9,1.2-7
c-1.3-2.9-4.9-4-5.5-7.2c-1.2-4.8,3.3-10.1,8.2-9.8c4.8-0.1,8.3,5,6.3,9.6c-1.2,3.7-5.8,4.8-7.2,8.4c-1.7,3.2,0.4,6.1,2.4,8.2
C300,329.6,298.8,333.8,295.8,335.2L295.8,335.2z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

@@ -403,6 +403,7 @@ const driverProfiles: Record<
jdbc: { type: "jdbc", port: 0, user: "", label: "JDBC", icon: "jdbc" },
tdengine: { type: "tdengine", port: 6041, user: "root", label: "TDengine", icon: "tdengine" },
xugu: { type: "xugu", port: 5138, user: "", label: "虚谷 XuguDB", icon: "xugu" },
iotdb: { type: "iotdb", port: 6667, user: "root", label: "Apache IoTDB", icon: "iotdb" },
iris: { type: "iris", port: 1972, user: "_SYSTEM", label: "IRIS", icon: "iris" },
custom_mysql: {
type: "mysql",
@@ -659,6 +660,7 @@ const iconTypeMap: Record<string, string> = {
cockroachdb: "cockroachdb",
tdengine: "tdengine",
xugu: "xugu",
iotdb: "iotdb",
dm: "dm",
h2: "h2",
snowflake: "snowflake",
@@ -730,6 +732,7 @@ const dbOptions = [
{ value: "kylin", label: "Kylin" },
{ value: "sundb", label: "SunDB" },
{ value: "xugu", label: "虚谷 XuguDB" },
{ value: "iotdb", label: "Apache IoTDB" },
{ value: "iris", label: "IRIS" },
{ value: "jdbc", label: "JDBC" },
{ value: "custom_mysql", label: "Custom (MySQL)" },
@@ -68,6 +68,7 @@ const assetIcons: Record<string, string> = {
polardb: "polardb.webp",
greatsql: "greatsql.webp",
xugu: "xugu.png",
iotdb: "iotdb",
iris: "iris.png",
};
@@ -136,6 +136,9 @@ export function connectionUrlPlaceholder(dbType: DatabaseType): string {
case "xugu":
return "xugu://user:password@host:5138/database";
case "iotdb":
return "iotdb://user:password@host:6667/root.test";
case "bigquery":
return "bigquery://https://www.googleapis.com/bigquery/v2:443/project-id";
+1
View File
@@ -49,6 +49,7 @@ const SCHEME_PROFILES: Record<string, ConnectionProfile> = {
tdengine: { type: "tdengine", profile: "tdengine", label: "TDengine", defaultPort: 6041 },
"taos-ws": { type: "tdengine", profile: "tdengine", label: "TDengine", defaultPort: 6041 },
xugu: { type: "xugu", profile: "xugu", label: "XuguDB", defaultPort: 5138 },
iotdb: { type: "iotdb", profile: "iotdb", label: "Apache IoTDB", defaultPort: 6667 },
iris: { type: "iris", profile: "iris", label: "IRIS", defaultPort: 1972 },
};
@@ -28,6 +28,7 @@ export const SCHEMA_AWARE_TYPES = new Set<DatabaseType>([
"db2",
"tdengine",
"xugu",
"iotdb",
"iris",
"duckdb",
]);
@@ -106,6 +107,7 @@ export const DATABASE_SEARCH_SUPPORTED_TYPES = new Set<DatabaseType>([
"sundb",
"tdengine",
"xugu",
"iotdb",
"iris",
]);
@@ -224,6 +226,7 @@ export const TREE_SCHEMA_TYPES = new Set<DatabaseType>([
"h2",
"tdengine",
"xugu",
"iotdb",
"iris",
"duckdb",
]);
@@ -264,6 +267,7 @@ export const AGENT_DRIVER_TYPES = new Set<DatabaseType>([
"gaussdb",
"tdengine",
"xugu",
"iotdb",
"iris",
]);
+8
View File
@@ -17,6 +17,7 @@ export interface BuildTableSelectSqlOptions {
}
export function quoteTableIdentifier(databaseType: DatabaseType | undefined, name: string): string {
if (databaseType === "iotdb") return name;
if (databaseType === "jdbc") return quoteJdbcIdentifier(name);
if (databaseType === "mysql" || databaseType === "hive" || databaseType === "tdengine" || databaseType === "access")
return `\`${name.replace(/`/g, "``")}\``;
@@ -39,6 +40,13 @@ export function qualifiedTableName(
options: Pick<BuildTableSelectSqlOptions, "databaseType" | "schema" | "tableName">,
): string {
const { databaseType, schema, tableName } = options;
if (databaseType === "iotdb") {
const trimmedSchema = schema?.trim();
if (trimmedSchema && tableName !== trimmedSchema && !tableName.startsWith(`${trimmedSchema}.`)) {
return `${quoteTableIdentifier(databaseType, trimmedSchema)}.${quoteTableIdentifier(databaseType, tableName)}`;
}
return quoteTableIdentifier(databaseType, tableName);
}
if (isSchemaAware(databaseType) && !usesDatabaseObjectTreeMode(databaseType) && schema) {
return `${quoteTableIdentifier(databaseType, schema)}.${quoteTableIdentifier(databaseType, tableName)}`;
}
+1
View File
@@ -44,6 +44,7 @@ export type DatabaseType =
| "sundb"
| "tdengine"
| "xugu"
| "iotdb"
| "iris"
| "jdbc";
@@ -484,6 +484,17 @@
"skipTcpProbe": true,
"defaultPort": 5138
},
{
"dbType": "iotdb",
"label": "Apache IoTDB",
"runtimeMode": "agent",
"mcpMode": "bridge",
"agentKey": "iotdb",
"singleConnectionPool": false,
"metadataConnectionScoped": false,
"skipTcpProbe": true,
"defaultPort": 6667
},
{
"dbType": "iris",
"label": "InterSystems IRIS",
+7
View File
@@ -217,6 +217,13 @@ const AGENT_CATALOG: &[AgentCatalogEntry] = &[
store_visible: true,
profiles: &[],
},
AgentCatalogEntry {
db_type: DatabaseType::Iotdb,
key: "iotdb",
label: "Apache IoTDB",
store_visible: true,
profiles: &[],
},
AgentCatalogEntry {
db_type: DatabaseType::MongoDb,
key: "mongodb",
+1
View File
@@ -474,6 +474,7 @@ impl AppState {
| DatabaseType::Sundb
| DatabaseType::Tdengine
| DatabaseType::Xugu
| DatabaseType::Iotdb
| DatabaseType::Iris
| DatabaseType::Access => {
let connect_params =
+17
View File
@@ -253,6 +253,7 @@ pub enum DatabaseType {
Sundb,
Tdengine,
Xugu,
Iotdb,
#[serde(rename = "iris")]
Iris,
Jdbc,
@@ -681,6 +682,14 @@ impl ConnectionConfig {
DatabaseType::Sundb => format!("sundb://{host}:{port}{db_part}"),
DatabaseType::Tdengine => format!("tdengine://{host}:{port}{db_part}"),
DatabaseType::Xugu => format!("xugu://{host}:{port}{db_part}"),
DatabaseType::Iotdb => {
let base = format!("iotdb://{host}:{port}{db_part}");
if params.is_empty() {
base
} else {
format!("{base}?{params}")
}
}
DatabaseType::Iris => format!("iris://{host}:{port}{db_part}"),
DatabaseType::Jdbc => "jdbc:<redacted>".to_string(),
}
@@ -853,6 +862,14 @@ impl ConnectionConfig {
DatabaseType::Xugu => {
format!("xugu://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::Iotdb => {
let base = format!("iotdb://{}:{}@{host}:{port}{db_part}", username, password);
if params.is_empty() {
base
} else {
format!("{base}?{params}")
}
}
DatabaseType::Iris => {
format!("iris://{}:{}@{host}:{port}{db_part}", username, password)
}
+45
View File
@@ -170,6 +170,17 @@ pub fn build_table_select_sql(options: TableSelectSqlOptions<'_>) -> String {
}
pub fn qualified_table_name(database_type: Option<DatabaseType>, schema: Option<&str>, table_name: &str) -> String {
if database_type == Some(DatabaseType::Iotdb) {
let table_name = quote_table_identifier(database_type, table_name);
let schema = schema.map(str::trim).filter(|schema| !schema.is_empty());
if let Some(schema) = schema {
if table_name == schema || table_name.starts_with(&format!("{schema}.")) {
return table_name;
}
return format!("{}.{}", quote_table_identifier(database_type, schema), table_name);
}
return table_name;
}
if database_type.is_some_and(is_schema_aware)
&& database_type != Some(DatabaseType::Jdbc)
&& schema.is_some_and(|schema| !schema.trim().is_empty())
@@ -185,6 +196,7 @@ pub fn qualified_table_name(database_type: Option<DatabaseType>, schema: Option<
pub fn quote_table_identifier(database_type: Option<DatabaseType>, name: &str) -> String {
match database_type {
Some(DatabaseType::Iotdb) => name.to_string(),
Some(DatabaseType::Jdbc) if is_simple_jdbc_identifier(name) => name.to_string(),
Some(DatabaseType::Jdbc) => format!("`{}`", name.replace('`', "``")),
Some(
@@ -404,6 +416,7 @@ mod tests {
assert_eq!(quote_table_identifier(Some(DatabaseType::Informix), "users_1"), "users_1");
assert_eq!(quote_table_identifier(Some(DatabaseType::Jdbc), "users_1"), "users_1");
assert_eq!(quote_table_identifier(Some(DatabaseType::Jdbc), "user name"), "`user name`");
assert_eq!(quote_table_identifier(Some(DatabaseType::Iotdb), "root.test.device2"), "root.test.device2");
}
#[test]
@@ -412,6 +425,11 @@ mod tests {
assert_eq!(qualified_table_name(Some(DatabaseType::Kwdb), Some("public"), "users"), "\"public\".\"users\"");
assert_eq!(qualified_table_name(Some(DatabaseType::Mysql), Some("public"), "users"), "`users`");
assert_eq!(qualified_table_name(Some(DatabaseType::Jdbc), Some("cbsdw_dwd"), "dwd_test_df"), "dwd_test_df");
assert_eq!(qualified_table_name(Some(DatabaseType::Iotdb), Some("root.test"), "device2"), "root.test.device2");
assert_eq!(
qualified_table_name(Some(DatabaseType::Iotdb), Some("root.test"), "root.test.device2"),
"root.test.device2"
);
}
#[test]
@@ -474,6 +492,17 @@ mod tests {
}),
"SELECT TOP 100 * FROM \"Ens\".\"AlarmResponse\""
);
assert_eq!(
build_table_select_sql(TableSelectSqlOptions {
database_type: Some(DatabaseType::Iotdb),
schema: Some("root.test"),
table_name: "device2",
columns: &[],
order_columns: &[],
limit: 100,
}),
"SELECT * FROM root.test.device2 LIMIT 100;"
);
}
#[test]
@@ -526,6 +555,22 @@ mod tests {
}),
"SELECT TOP 100 * FROM \"Ens\".\"AlarmResponse\""
);
assert_eq!(
build_table_data_select_sql(TableDataSelectSqlOptions {
database_type: Some(DatabaseType::Iotdb),
schema: Some("root.test".to_string()),
table_name: "device2".to_string(),
primary_keys: Vec::new(),
columns: Vec::new(),
fallback_order_columns: Vec::new(),
order_by: None,
limit: Some(100),
offset: None,
where_input: None,
include_row_id: false,
}),
"SELECT * FROM root.test.device2 LIMIT 100;"
);
}
#[test]
+1
View File
@@ -43,6 +43,7 @@ fn built_in_agent_list_includes_expected_driver_labels() {
let agents = build_agent_list(&manager, None);
assert!(agents.iter().any(|agent| agent.db_type == "tdengine" && agent.label == "TDengine"));
assert!(agents.iter().any(|agent| agent.db_type == "iotdb" && agent.label == "Apache IoTDB"));
assert!(agents.iter().any(|agent| agent.db_type == "yashandb" && agent.label == "崖山 YashanDB"));
assert!(agents.iter().any(|agent| agent.db_type == "access" && agent.label == "Microsoft Access"));
}
@@ -50,6 +50,7 @@ fn maps_agent_database_types_to_driver_keys() {
assert_eq!(agent_key(&DatabaseType::Trino, None), Some("trino"));
assert_eq!(agent_key(&DatabaseType::Hive, None), Some("hive"));
assert_eq!(agent_key(&DatabaseType::Tdengine, None), Some("tdengine"));
assert_eq!(agent_key(&DatabaseType::Iotdb, None), Some("iotdb"));
assert_eq!(agent_key(&DatabaseType::Yashandb, None), Some("yashandb"));
assert_eq!(agent_key(&DatabaseType::Databricks, None), Some("databricks"));
assert_eq!(agent_key(&DatabaseType::SapHana, None), Some("saphana"));
@@ -72,6 +73,7 @@ fn classifies_agent_database_types() {
assert!(is_agent_type(&DatabaseType::Trino));
assert!(is_agent_type(&DatabaseType::Hive));
assert!(is_agent_type(&DatabaseType::Tdengine));
assert!(is_agent_type(&DatabaseType::Iotdb));
assert!(is_agent_type(&DatabaseType::Yashandb));
assert!(is_agent_type(&DatabaseType::Databricks));
assert!(is_agent_type(&DatabaseType::SapHana));
@@ -125,6 +127,7 @@ fn skips_tcp_probe_for_local_file_plugin_and_agent_types() {
assert!(skips_tcp_probe(&DatabaseType::Trino));
assert!(skips_tcp_probe(&DatabaseType::Oracle));
assert!(skips_tcp_probe(&DatabaseType::Tdengine));
assert!(skips_tcp_probe(&DatabaseType::Iotdb));
assert!(skips_tcp_probe(&DatabaseType::Yashandb));
assert!(skips_tcp_probe(&DatabaseType::Databricks));
assert!(skips_tcp_probe(&DatabaseType::OceanbaseOracle));
+14
View File
@@ -135,6 +135,20 @@ test("parses XuguDB JDBC URLs", () => {
assert.equal(parsed.urlParams, "charset=utf8");
});
test("parses Apache IoTDB JDBC URLs", () => {
const parsed = parseConnectionUrl("jdbc:iotdb://root:secret@iotdb.example.com:6667?sql_dialect=table");
assert.equal(parsed.dbType, "iotdb");
assert.equal(parsed.driverProfile, "iotdb");
assert.equal(parsed.driverLabel, "Apache IoTDB");
assert.equal(parsed.host, "iotdb.example.com");
assert.equal(parsed.port, 6667);
assert.equal(parsed.username, "root");
assert.equal(parsed.password, "secret");
assert.equal(parsed.database, undefined);
assert.equal(parsed.urlParams, "sql_dialect=table");
});
test("parses GBase 8s JDBC URLs", () => {
const parsed = parseConnectionUrl(
"jdbc:gbasedbt-sqli://gbasedbt:secret@gbase.example.com:20013/testdb:GBASEDBTSERVER=gbase01;CLIENT_LOCALE=zh_cn.utf8",
@@ -23,6 +23,7 @@ const expected: Record<string, string> = {
dameng: "dm://user:password@host:port",
tdengine: "tdengine://user:password@host:6041/database",
xugu: "xugu://user:password@host:5138/database",
iotdb: "iotdb://user:password@host:6667/root.test",
bigquery: "bigquery://https://www.googleapis.com/bigquery/v2:443/project-id",
jdbc: "jdbc:mysql://host:3306/database",
};
@@ -45,6 +45,13 @@ test("treats XuguDB as a schema-aware agent driver database", () => {
assert.equal(supportsDriverManagement("xugu"), true);
});
test("treats IoTDB as a schema-aware agent driver database", () => {
assert.equal(TREE_SCHEMA_TYPES.has("iotdb"), true);
assert.equal(SCHEMA_AWARE_TYPES.has("iotdb"), true);
assert.equal(supportsDatabaseSearch("iotdb"), true);
assert.equal(supportsDriverManagement("iotdb"), true);
});
test("treats Access as a local single-database agent driver", () => {
assert.equal(SCHEMA_AWARE_TYPES.has("access"), false);
assert.equal(supportsDriverManagement("access"), true);
+12
View File
@@ -15,3 +15,15 @@ test("JDBC table identifiers use backticks only when quoting is needed", () => {
assert.equal(quoteTableIdentifier("jdbc", "daily orders"), "`daily orders`");
assert.equal(quoteTableIdentifier("jdbc", "daily`orders"), "`daily``orders`");
});
test("IoTDB table identifiers use tree paths without SQL quotes", () => {
assert.equal(quoteTableIdentifier("iotdb", "root.test.device2"), "root.test.device2");
assert.equal(
qualifiedTableName({ databaseType: "iotdb", schema: "root.test", tableName: "device2" }),
"root.test.device2",
);
assert.equal(
qualifiedTableName({ databaseType: "iotdb", schema: "root.test", tableName: "root.test.device2" }),
"root.test.device2",
);
});
+3 -3
View File
@@ -46,7 +46,7 @@ function formatQueryToolResult(result: QueryResult, title?: string) {
}
export const DBX_CONNECTION_TYPE_DESCRIPTION =
"Database type: postgres, mysql, sqlite, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, xugu, jdbc, access";
"Database type: postgres, mysql, sqlite, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, iotdb, xugu, jdbc, access";
export function createDbxMcpServer(backend: Backend, options: { isWebMode?: boolean } = {}): McpServer {
const isWebMode = options.isWebMode ?? !!process.env.DBX_WEB_URL;
@@ -171,7 +171,7 @@ export function createDbxMcpServer(backend: Backend, options: { isWebMode?: bool
name: z.string().describe("Connection name"),
db_type: z.string().describe(DBX_CONNECTION_TYPE_DESCRIPTION),
host: z.string().describe("Database host"),
port: z.number().optional().describe("Database port (TDengine defaults to 6041, XuguDB defaults to 5138)"),
port: z.number().optional().describe("Database port (TDengine defaults to 6041, IoTDB defaults to 6667, XuguDB defaults to 5138)"),
username: z.string().default("").describe("Username"),
password: z.string().default("").describe("Password"),
database: z.string().optional().describe("Default database name"),
@@ -181,7 +181,7 @@ export function createDbxMcpServer(backend: Backend, options: { isWebMode?: bool
const existing = await backend.findConnection(name);
if (existing) return text(`Connection "${name}" already exists.`);
const FILE_BASED_TYPES = new Set(["sqlite", "duckdb", "access"]);
const DEFAULT_PORTS: Record<string, number> = { kwdb: 26257, rqlite: 4001, tdengine: 6041, xugu: 5138 };
const DEFAULT_PORTS: Record<string, number> = { kwdb: 26257, rqlite: 4001, tdengine: 6041, iotdb: 6667, xugu: 5138 };
const resolvedPort = port ?? DEFAULT_PORTS[db_type] ?? (FILE_BASED_TYPES.has(db_type) ? 0 : undefined);
if (resolvedPort === undefined) return text("Port is required for this database type.");
const config = await backend.addConnection({
+1
View File
@@ -46,6 +46,7 @@ export const BRIDGE_REQUIRED_TYPES = [
"oceanbase-oracle",
"gbase",
"tdengine",
"iotdb",
"h2",
"snowflake",
"trino",