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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(mysql): health-check pooled connection before DDL query
jischeng82fd078c1009
diff --git a/crates/dbx-core/src/schema.rs b/crates/dbx-core/src/schema.rsindex e18134991a..f46e234153 100644--- a/crates/dbx-core/src/schema.rs+++ b/crates/dbx-core/src/schema.rs@@ -3465,7 +3465,12 @@ mod ddl_tests {pub async fn mysql_ddl(pool: &db::mysql::MySqlPool, table: &str) -> Result<String, String> {use mysql_async::prelude::*;let sql = format!("SHOW CREATE TABLE `{}`", table.replace('`', "``"));- let mut conn = pool.get_conn().await.map_err(|e| e.to_string())?;+ // Use the health-checked getter so a stale pooled connection (server closed+ // it after an idle timeout, NAT/firewall dropped the TCP state, etc.) is+ // detected and replaced before issuing the query. Without this, the first+ // DDL request after a period of inactivity could surface a low-level+ // connection error that a manual refresh would have masked.+ let mut conn = db::mysql::get_conn_with_health_check(pool).await?;let result = conn.query_iter(&sql).await.map_err(|e| e.to_string())?;let rows: Vec<mysql_async::Row> = result.collect_and_drop().await.map_err(|e| e.to_string())?;let row = rows.first().ok_or("DDL not found")?;diff --git a/crates/dbx-web/src/routes/connection.rs b/crates/dbx-web/src/routes/connection.rsindex 9335837f15..5a3a8c80a9 100644--- a/crates/dbx-web/src/routes/connection.rs+++ b/crates/dbx-web/src/routes/connection.rs@@ -286,6 +286,7 @@ mod tests {redis_sentinel_tls: false,redis_cluster_nodes: String::new(),redis_key_separator: dbx_core::models::connection::default_redis_key_separator(),+ redis_scan_page_size: None,etcd_endpoints: String::new(),gbase_server: String::new(),informix_server: String::new(),diff --git a/src-tauri/src/commands/connection.rs b/src-tauri/src/commands/connection.rsindex ec21b7813c..6e705af38b 100644--- a/src-tauri/src/commands/connection.rs+++ b/src-tauri/src/commands/connection.rs@@ -248,6 +248,7 @@ mod tests {redis_sentinel_tls: false,redis_cluster_nodes: String::new(),redis_key_separator: dbx_core::models::connection::default_redis_key_separator(),+ redis_scan_page_size: None,etcd_endpoints: String::new(),gbase_server: String::new(),informix_server: String::new(),