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(prestosql): avoid duplicate JDBC URL parameters

t8y29fda1d690a0f
diff --git a/crates/dbx-core/src/connection.rs b/crates/dbx-core/src/connection.rs
index 1ef5b44519..2b24223dd4 100644
--- a/crates/dbx-core/src/connection.rs
+++ b/crates/dbx-core/src/connection.rs
@@ -620,6 +620,7 @@ pub fn prestosql_jdbc_config_for_endpoint(config: &ConnectionConfig, host: &str,
let mut jdbc_config = config.clone();
jdbc_config.connection_string =
Some(trino_like_jdbc_connection_string(config, host, port, config.effective_database().unwrap_or("")));
+ jdbc_config.url_params = None;
if jdbc_config.jdbc_driver_class.as_deref().is_none_or(|value| value.trim().is_empty()) {
jdbc_config.jdbc_driver_class = Some(PRESTOSQL_JDBC_DRIVER_CLASS.to_string());
}
@@ -4896,6 +4897,26 @@ mod tests {
assert_eq!(jdbc_config.jdbc_driver_paths, vec!["D:\\software\\jar\\presto-jdbc-350.jar"]);
}
+ #[test]
+ fn prestosql_jdbc_config_consumes_url_params_after_building_url() {
+ let mut config = mysql_config(None);
+ config.db_type = DatabaseType::PrestoSql;
+ config.ssl = true;
+ config.url_params = Some(
+ "SSL=true&SSLKeyStorePassword=secret&SSLKeyStorePath=D:/keystore/presto/presto_keystore.jks".to_string(),
+ );
+
+ let jdbc_config = prestosql_jdbc_config_for_endpoint(&config, "presto.example.com", 8443);
+
+ assert_eq!(
+ jdbc_config.connection_string.as_deref(),
+ Some(
+ "jdbc:presto://presto.example.com:8443?SSL=true&SSLKeyStorePassword=secret&SSLKeyStorePath=D:/keystore/presto/presto_keystore.jks"
+ )
+ );
+ assert_eq!(jdbc_config.url_params, None);
+ }
+
#[test]
fn gaussdb_m_profile_uses_vendor_jdbc_url_and_driver() {
let mut config = mysql_config(Some("业务库"));