.NET 8.0(x64)下Embedded Firebird连接失败求助
.NET 8.0连接Firebird嵌入式数据库的问题
我正在尝试用.NET 8.0应用连接Firebird嵌入式数据库,服务器模式下使用以下连接字符串可正常连接现有数据库:
datasource=localhost;database=C:/Db/Test/MyDB.FDB;user id=SYSDBA;password=pwd;port number=3050;dialect=3;pooling=True;server type=0;character set=UTF8;connection lifetime=15;min pool size=0;max pool size=50;packet size=8192;wire crypt=Enabled;client library=fbclient.dll
随后我将server type从0改为1,并通过以下代码额外配置切换至嵌入式模式:
FbConnectionStringBuilder conn = new FbConnectionStringBuilder(_connectionStr); // 确保使用嵌入式模式 conn.ServerType = FbServerType.Embedded; // 测试连接 - 嵌入式模式下不应设置DataSource和密码 if (conn.ServerType == FbServerType.Embedded) { conn.ClientLibrary = "fbclient.dll"; conn.DataSource = ""; conn.UserID = "SYSDBA"; conn.Password = ""; } else { conn.ClientLibrary = "fbclient.dll"; conn.WireCrypt = FbWireCrypt.Enabled; } try { using (FbConnection db = new FbConnection(conn.ConnectionString)) { db.Open(); db.Close(); }
遇到的错误
- 当本地Firebird服务运行时,报错:
Your user name and password are not defined. Ask your database administrator to set up a Firebird login
- 停止服务后,已确保添加所有必要文件,但仍报错:
Unable to complete network request to host "xnet://Global\FIREBIRD".'
已尝试的排查操作
- 确认程序与dll位数一致(尝试过AnyCPU和x64,使用x64文件)
- 启用了旧版认证模式
请问在.NET 8.0中是否能正常使用Embedded Firebird模式?
内容的提问来源于stack exchange,提问作者neggenbe
相关产品推荐
相关产品推荐

