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): detect idle timeout and end-of-file as connection errors

t8y2c289c0d2f3f4
diff --git a/crates/dbx-core/src/query.rs b/crates/dbx-core/src/query.rs
index ad57b2e14b..3352d37f39 100644
--- a/crates/dbx-core/src/query.rs
+++ b/crates/dbx-core/src/query.rs
@@ -344,6 +344,9 @@ pub fn is_connection_error(err: &str) -> bool {
|| lower.contains("closed")
|| lower.contains("eof")
|| lower.contains("i/o error")
+ || lower.contains("not connected")
+ || lower.contains("end-of-file")
+ || lower.contains("idle")
|| is_os_connection_error(&lower)
}
@@ -1162,6 +1165,17 @@ mod tests {
assert!(is_connection_error("unexpected eof"));
}
+ #[test]
+ fn is_connection_error_detects_oracle_idle_timeout() {
+ assert!(is_connection_error("ORA-02396: exceeded maximum idle time, please connect again"));
+ assert!(is_connection_error(
+ "Agent RPC error (-32603): ORA-02396: exceeded maximum idle time, please connect again"
+ ));
+ assert!(is_connection_error("ORA-03113: end-of-file on communication channel"));
+ assert!(is_connection_error("ORA-03114: not connected to Oracle"));
+ assert!(is_connection_error("ORA-03135: connection lost contact"));
+ }
+
#[test]
fn is_connection_error_detects_localized_io_errors() {
assert!(is_connection_error("I/O error: 远程主机强迫关闭了一个现有的连接。 (os error 10054)"));