From e315c4ad3604a47bb3e1b00c7ae684d96e8752e5 Mon Sep 17 00:00:00 2001
From: t8y2 <1156263951@qq.com>
Date: Wed, 6 May 2026 13:23:56 +0800
Subject: [PATCH] feat(oracle): add SYSDBA authentication support
Switch oracle-rs to t8y2/oracle-rs fork with SYSDBA support.
Add sysdba field to ConnectionConfig and a checkbox in the
Oracle connection dialog to enable connecting as SYS with
SYSDBA privileges.
---
Cargo.lock | 36 +++++++++++++++++--
crates/dbx-core/Cargo.toml | 2 +-
crates/dbx-core/src/connection.rs | 1 +
crates/dbx-core/src/db/oracle_driver.rs | 12 +++++--
crates/dbx-core/src/models/connection.rs | 3 ++
src-tauri/src/commands/connection.rs | 2 ++
.../connection/ConnectionDialog.vue | 8 +++++
src/types/database.ts | 1 +
8 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 7da15178a..3fdbe213a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1553,7 +1553,7 @@ dependencies = [
"futures",
"log",
"mongodb",
- "oracle-rs",
+ "oracle-rs 0.1.7",
"percent-encoding",
"portpicker",
"redis",
@@ -1590,7 +1590,7 @@ dependencies = [
"futures",
"log",
"mongodb",
- "oracle-rs",
+ "oracle-rs 0.1.6",
"percent-encoding",
"portpicker",
"redis",
@@ -4510,6 +4510,38 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
+[[package]]
+name = "oracle-rs"
+version = "0.1.6"
+source = "git+https://github.com/t8y2/oracle-rs?branch=main#97d99d43e3d1323f7d544db8e0fdaaa0ba95cd24"
+dependencies = [
+ "aes 0.8.4",
+ "async-trait",
+ "bytes",
+ "cbc 0.1.2",
+ "chrono",
+ "hex",
+ "hmac 0.12.1",
+ "hostname",
+ "indexmap 2.14.0",
+ "md-5",
+ "pbkdf2 0.12.2",
+ "pkcs8 0.10.2",
+ "rand 0.8.6",
+ "rustls 0.23.40",
+ "rustls-pemfile 2.2.0",
+ "rustls-pki-types",
+ "serde",
+ "serde_json",
+ "sha1 0.10.6",
+ "sha2 0.10.9",
+ "thiserror 1.0.69",
+ "tokio",
+ "tokio-rustls 0.26.4",
+ "tracing",
+ "webpki-roots 0.26.11",
+]
+
[[package]]
name = "oracle-rs"
version = "0.1.7"
diff --git a/crates/dbx-core/Cargo.toml b/crates/dbx-core/Cargo.toml
index cff86f58a..b69638b4e 100644
--- a/crates/dbx-core/Cargo.toml
+++ b/crates/dbx-core/Cargo.toml
@@ -22,7 +22,7 @@ tiberius = { version = "0.12.3", default-features = false, features = ["tds73",
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "rustls-tls"] }
futures = "0.3"
mongodb = "3.2.5"
-oracle-rs = "0.1"
+oracle-rs = { git = "https://github.com/t8y2/oracle-rs", branch = "main" }
russh = "0.60"
portpicker = "0.1.1"
csv = "1"
diff --git a/crates/dbx-core/src/connection.rs b/crates/dbx-core/src/connection.rs
index a7452c148..1c5a2983f 100644
--- a/crates/dbx-core/src/connection.rs
+++ b/crates/dbx-core/src/connection.rs
@@ -138,6 +138,7 @@ impl AppState {
db_config.database.as_deref().unwrap_or("ORCL"),
&db_config.username,
&db_config.password,
+ db_config.sysdba,
)
.await?;
PoolKind::Oracle(Arc::new(tokio::sync::Mutex::new(client)))
diff --git a/crates/dbx-core/src/db/oracle_driver.rs b/crates/dbx-core/src/db/oracle_driver.rs
index 9262a8f83..d94b6f2e4 100644
--- a/crates/dbx-core/src/db/oracle_driver.rs
+++ b/crates/dbx-core/src/db/oracle_driver.rs
@@ -6,8 +6,16 @@ use crate::types::{ColumnInfo, DatabaseInfo, ForeignKeyInfo, IndexInfo, QueryRes
pub type OracleClient = Connection;
-pub async fn connect(host: &str, port: u16, service: &str, user: &str, pass: &str) -> Result