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(oracle): default to service_name when oracle_connection_type is unset

t8y226878e749ab5
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue
index a2c5961985..80b85cf3d5 100644
--- a/apps/desktop/src/components/connection/ConnectionDialog.vue
+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue
@@ -342,7 +342,7 @@ watch(
proxy_username: config.proxy_username || "",
proxy_password: config.proxy_password || "",
ssl: config.ssl || false,
- oracle_connection_type: config.oracle_connection_type || "sid",
+ oracle_connection_type: config.oracle_connection_type || "service_name",
connection_string: config.connection_string,
jdbc_driver_class: config.jdbc_driver_class,
jdbc_driver_paths: config.jdbc_driver_paths || [],
diff --git a/crates/dbx-core/src/connection.rs b/crates/dbx-core/src/connection.rs
index 3f023da665..e617d01d45 100644
--- a/crates/dbx-core/src/connection.rs
+++ b/crates/dbx-core/src/connection.rs
@@ -619,10 +619,10 @@ fn oracle_jdbc_connection_string(config: &ConnectionConfig, host: &str, port: u1
return config.connection_string.as_deref().unwrap_or("").to_string();
}
- if config.oracle_connection_type.as_deref() == Some("service_name") {
- format!("jdbc:oracle:thin:@//{host}:{port}/{database}")
- } else {
+ if config.oracle_connection_type.as_deref() == Some("sid") {
format!("jdbc:oracle:thin:@{host}:{port}:{database}")
+ } else {
+ format!("jdbc:oracle:thin:@//{host}:{port}/{database}")
}
}
@@ -643,10 +643,8 @@ pub fn oracle_alternate_connect_config(config: &ConnectionConfig, err: &str) ->
}
let mut retry = config.clone();
- retry.oracle_connection_type = Some(
- if config.oracle_connection_type.as_deref() == Some("service_name") { "sid" } else { "service_name" }
- .to_string(),
- );
+ retry.oracle_connection_type =
+ Some(if config.oracle_connection_type.as_deref() == Some("sid") { "service_name" } else { "sid" }.to_string());
Some(retry)
}
@@ -865,14 +863,14 @@ mod tests {
}
#[test]
- fn agent_connect_params_preserve_legacy_oracle_configs_as_sid() {
+ fn agent_connect_params_preserve_legacy_oracle_configs_as_service_name() {
let mut config = mysql_config(Some("ORCL"));
config.db_type = DatabaseType::Oracle;
config.oracle_connection_type = None;
let params = agent_connect_params(&config, "127.0.0.1", 11521, "ORCL");
- assert_eq!(params["connection_string"], "jdbc:oracle:thin:@127.0.0.1:11521:ORCL");
+ assert_eq!(params["connection_string"], "jdbc:oracle:thin:@//127.0.0.1:11521/ORCL");
}
#[test]