【问题标题】:Migrate Firebird 2.5 to 4.0 using ADO.Net provider使用 ADO.Net 提供程序将 Firebird 2.5 迁移到 4.0
【发布时间】:2021-06-08 22:07:40
【问题描述】:

我刚刚将我的数据库升级到 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 ,我会得到

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

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

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

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

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

尝试 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=启用或必需)

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

尝试 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=启用或必需)

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

尝试 4:

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

连接字符串(与连接字符串中的任何有线加密选项相同的结果):

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: 读取 errno = 10054,客户端主机 = DESKTOP-1234,地址 = 127.0.0.1/60348,用户 = myusername

【问题讨论】:

    标签: c# ado.net firebird firebird-.net-provider firebird-4.0


    【解决方案1】:

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

    另请参阅此问题:Support for Srp256 [DNET942] #864

    【讨论】:

    • 感谢您的澄清,但没有任何帮助 - 尽管我尝试使用 firbird.conf 设置,但仍然是相同的 No matching plugins on server 错误。是否有已知可以工作的示例安装文件?也许我确实错过了安装一些插件(在这种情况下,我怎么知道是哪个?)
    • @neggenbe 我需要尝试一下,但我要到本周晚些时候才有时间,也许你还需要将wire crypt 插件设置限制为仅限 Arc4
    • 好吧,只是为了记录:我删除了 Firebird 4.0 并用 Firebird 3.0 替换它,然后恢复了我的数据库(从 2.5 开始的 gback)并使用完全相同的代码(即使使用 FbWireCrypt.Enabled 和它无缝工作。所以我缺少一些关于 FB 4.0 的东西(我想这与安全数据库或 firebird.conf 在这种情况下有关)!
    • @neggenbe 我测试了它,使用默认的 firebird.conf,我唯一需要修改的是使用 AuthServer = Srp256,Srp 而不是默认值。确保 Srp 用户管理器的用户确实存在(例如,通过连接到数据库员工并执行 create user sysdba password 'masterkey' using plugin srp
    • 也许在未来的 Firebird 会议上;)
    【解决方案2】:

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

    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;
    

    【讨论】:

    • 您的情况无需更改AuthClient。另请注意,通过从AuthServer 列表中删除 Srp256,您会降低支持 Srp256 的客户端的安全性。最好设置为AuthServer = Srp256,Srp
    • @MarkRotteveel 一个快速的:我正在尝试“嵌入式”版本并遇到Your user name and password are not defined. Ask your database administrator to set up a Firebird login. - 我应该打开一个新线程吗?
    • 是的,当然,很可能您实际上并没有使用 Embedded,而只是一个 fbclient.dll,没有插件/engine13.dll 和 Firebird Embedded 所需的其他支持文件。
    • 好的,开始工作了。我认为我复制了旧的 firebird.conf 文件 - 一切都很好!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-21
    • 1970-01-01
    • 2013-11-18
    • 1970-01-01
    • 1970-01-01
    • 2011-10-11
    相关资源
    最近更新 更多