feat(oracle): add TNS connections and trigger editing

This commit is contained in:
t8y2 committed 2026-07-23 23:03:45 +08:00
1 parent 9a5edae219
commit 3b004abb1e
23 files changed
+980 -53

No files matched your search

+19
View File
@@ -262,6 +262,11 @@ pub fn oracle_alternate_connect_configs(config: &ConnectionConfig, err: &str) ->
if config.db_type != DatabaseType::Oracle {
return Vec::new();
}
if config.oracle_connection_type.as_deref() == Some("tns") {
// TNS owns its complete address/failover descriptor; host-based retries would
// replace the configured alias with unrelated Service Name/SID URLs.
return Vec::new();
}
if config.connection_string.as_deref().is_some_and(|value| !value.trim().is_empty()) {
return Vec::new();
}
@@ -804,6 +809,20 @@ mod tests {
assert_eq!(service["connection_string"], "jdbc:oracle:thin:@//oracle.example.com:1521/ORCL");
}
#[test]
fn oracle_tns_does_not_retry_with_host_based_descriptors() {
let mut cfg = config(DatabaseType::Oracle, Some("DBX_FAILOVER"));
cfg.oracle_connection_type = Some("tns".to_string());
cfg.connection_string =
Some("jdbc:oracle:thin:@DBX_FAILOVER?TNS_ADMIN=%2Fopt%2Foracle%2Fnetwork%2Fadmin".to_string());
assert!(oracle_alternate_connect_configs(
&cfg,
"ORA-12514: listener does not currently know of service requested"
)
.is_empty());
}
#[test]
fn oracle_sys_user_connects_as_sysdba_for_agent_protocol() {
let mut cfg = config(DatabaseType::Oracle, Some("ORCLPDB1"));