首页 > 解决方案 > 如果路径包含哈希符号,firebirdsql 无法连接到数据库

问题描述

我正在尝试在 Go (v1.14) 中使用firebirdsql连接到 Firebird 数据库。

db_path := "D:\\DBs\\test.fdb"
conn, err := sql.Open("firebirdsql", ("sysdba:master@127.0.0.1:3050/" + db_path) )
err = conn.Ping()
if err != nil {
    fmt.Println("db.Ping failed:", err)
}

上面的代码工作得很好,但是一旦我在路径中引入哈希符号 (#)(例如:) db_path := "D:\\#DBs\\test.fdb",我就无法连接,firebirdsql抱怨路径无效(它读取到哈希符号的路径):

db.Ping failed: I/O error during "CreateFile (open)" operation for file "D:\"
Error while trying to open file
The system cannot find the path specified.

它是firebirdsql中的错误还是我在这里做错了什么?

标签: gofirebird

解决方案


推荐阅读