微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 ADO.Net 提供程序将 Firebird 2.5 迁移到 4.0

如何解决使用 ADO.Net 提供程序将 Firebird 2.5 迁移到 4.0

我刚刚将我的数据库升级到 Firebird 4.0,在使用数据库管理工具连接到数据库时,一切似乎都可以正常工作。

所以现在我尝试连接,在确保我已将 ADO.Net 升级到 Firebirdsql.Data.FirebirdClient v8.0.1(最新)之后。

这是我创建连接字符串的方法(是的,数据库路径存在并且我确保用户具有修改权限):

 FbConnectionStringBuilder cs = new FbConnectionStringBuilder();
 cs.Database = @"C:/myPath/MyDB.fdb";
 cs.DataSource = "localhost";
 cs.UserID = "sysdba";
 cs.Password = "masterkey";
 cs.Dialect = 3;
 cs.Pooling = false;
 cs.ServerType = FbServerType.Default;
 // --- Omitted at first - any of the 3 types leads to errors!
 //cs.WireCrypt = FbWireCrypt.disabled;
 var DBConn = new FbConnection(cs.ConnectionString);
 DBConn.open();

现在,请注意我遗漏了 WireCrypt 选项(有意开始)。我的错误是:

登录时出错,详情请查看服务器firebird.log

firebird.log 说:

身份验证错误服务器上没有匹配的插件

所以我搜索了一下,found hints 它可能来自有线加密。好吧,所以我确实尝试了所有 3 个版本的有线加密 - 如果我使用 requiredEnabled,我会收到上述错误。如果我使用 disabled ,我得到

客户端和服务器请求的有线加密级别不兼容

此外,我尝试在 WireCrypt = disabled 和我的代码中设置 firebird.conf,重新启动服务并再次测试 - 现在我得到了与前两种情况相同的结果:

身份验证错误服务器上没有匹配的插件

所以我想我在这里遗漏了一些关于加密插件的信息 - 但我在那里找不到任何有价值的信息,感谢您的帮助!

更新:这是我尝试过的设置和我得到的错误

尝试 1:所有 firebird.conf 认值(我张贴它 here 以保持简短):

连接字符串 1:

character set=NONE;data source=localhost;initial catalog=C:\Users\dbaccess\MYDB.fdb;user id=SYSDBA;password=masterkey;wire crypt=disabled

客户端和服务器请求的有线加密级别不兼容

连接字符串 2(wire crypt=Enabled 或 required

身份验证错误服务器上没有匹配的插件

尝试 2:

WireCrypt = disabled

连接字符串 1:

character set=NONE;data source=localhost;initial catalog=C:\Users\dbaccess\MYDB.fdb;user id=SYSDBA;password=masterkey;wire crypt=disabled

身份验证错误服务器上没有匹配的插件

连接字符串 2(wire crypt=Enabled)=> 同样的错误

尝试 3:

AuthClient = Srp256,Srp
UserManager = Srp

连接字符串 1:

character set=NONE;data source=localhost;initial catalog=C:\Users\dbaccess\MYDB.fdb;user id=SYSDBA;password=masterkey;wire crypt=disabled

客户端和服务器请求的有线加密级别不兼容

连接字符串 2(wire crypt=Enabled 或 required

身份验证错误服务器上没有匹配的插件

尝试 4:

AuthClient = Srp256,Srp
UserManager = Srp
WireCryptPlugin = ChaCha,Arc4
WireCrypt = Enabled
ServerMode = Super

连接字符串(与连接字符串中的任何 wire crypt 选项结果相同):

character set=NONE;data source=localhost;initial catalog=C:\Users\dbaccess\MYDB.fdb;user id=SYSDBA;password=masterkey;wire crypt=Enabled

身份验证错误服务器上没有匹配的插件

注意:我还在 firebird.log 中看到以下消息,这可能是由于服务重启...

inet_error: read errno = 10054,client host = DESKTOP-1234,address = 127.0.0.1/60348,user = myusername

解决方法

Firebird ADO.net 提供程序版本 8 在连接到 Firebird 3.0 或更高版本时仅支持 Srp 身份验证插件,但默认情况下 Firebird 4.0 仅使用更安全的 Srp256 插件。您需要将 AuthServer 中的 firebird.conf 设置更改为 Srp256,Srp,Firebird ADO.net 提供程序才能连接。

另见此问题:Support for Srp256 [DNET942] #864

,

好的,我最终使用以下设置让它工作:

firbird.conf

AuthServer =  Srp256,Srp
UserManager = Srp
WireCrypt = Enabled

和连接字符串代码:

FbConnectionStringBuilder bld = new FbConnectionStringBuilder();
bld.Charset = "NONE";
bld.DataSource = "localhost";
bld.Database = @"C:\Users\DBAccess\MYDB.FDB";
bld.UserID = "SYSDBA";
bld.Password = "masterkey";
bld.WireCrypt = FbWireCrypt.Enabled;
string connStr = bld.ConnectionString;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。