Does Firebird ADO.NET 4.10.0.0 Data provider work with Firebird 3.0?

给你一囗甜甜゛ 提交于 2019-12-21 20:22:30

问题


I'm currently trying to get my ASP.net 4.5 project connecting to the recently release Firebird 3.0.

I'm using Visual Studio 2015 Community edition, Firebird 3 (64 bit), and used NuGet to get the ADO.NET 4.10.0.0.

However, when I try to connect, I get an exception withe the following message:

this.connect.ServerVersion threw an exception of type 'System.InvalidOperationException'

Some other messages that I get:

Message: "The connection is closed"
Source: FirebirdSQL.Data.Fierbird.Client
StackTrace:
at FirebirdSql.Data.FirebirdClient.FbConnection.get_ServerVersion() in C:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbConnection.cs:line 217

IBExpert connects without any problems.

This environment previously worked with Firebird 2.5 and an older ADO.Net

Best guess right now is that it's not supported but my research online was inconclusive (from what I could find, there were indications that it was tested with Firebird 3 RC1)

If anyone can point me in the right direction to get this going, it would be awesome.

Thanks in advance!


回答1:


I am answering this on the assumption that you installed Firebird 3 and did not modify any of its configuration. By default the installation of Firebird 3 will have some strict security settings:

  • It will only support the new SRP authentication model
  • It will require wire protocol encryption

This means that drivers (like Firebird .NET provider 4.10) that do not yet support the SRP authentication model and wire protocol encryption will not be able to connect out of the box.

To be able to connect you will need to do the following

  1. Enable the legacy authentication model
  2. Downgrade the wire protocol encryption setting from required to enabled
  3. Create a user in the legacy authentication model

These steps all require edits to firebird.conf. If you installed Firebird into Program Files, you need to make sure your editor is running as administrator to be able to save the changes.

Enable legacy authentication

To enable legacy authentication, you need to edit or add the following line to firebird.conf: (note that lines prefixed with # are comments!)

AuthServer = Srp, Legacy_Auth

Downgrade wire protocol encryption

To downgrade the wire protocol encryption setting, you need to edit or add the following line to firebird.conf:

WireCrypt = Enabled

Create a legacy authentication user

To be able to create a user in the legacy authentication model, you need to enable the legacy usermanager plugin by editing or adding the following line to firebird.conf:

UserManager = Srp, Legacy_UserManager

After above changes, restart Firebird, connect to (any) Firebird 3 database with your favorite database management tool using SYSDBA or another admin account and create a user using the Legacy_UserManager with CREATE USER (replace username and password legacy with suitable values):

CREATE USER legacy PASSWORD 'legacy' USING PLUGIN Legacy_UserManager

Make sure to commit, otherwise the user is not really created.

Now you should be able to connect from C# using the user you just created.

This is also documented in the Firebird 3 Release Notes, Chapter 12 Compatibility Issues, Legacy Authentication.

Using gsec or the services functionality to create users is deprecated. If you still want to use either of these to create users in the legacy authentication model, you need to edit firebird.conf and put Legacy_UserManager first in the list.

Support in Firebird .NET provider version 5.0.0.0 and higher

Note that Firebird .NET provider version 5.0.0.0 added support for SRP (without wire protocol encryption). So from Firebird .NET provider version 5 you can use the new authentication model. Just make sure that you downgrade the wire protocol encryption (setting WireCrypt) from Required (default) to Enabled as described above.



来源:https://stackoverflow.com/questions/36752916/does-firebird-ado-net-4-10-0-0-data-provider-work-with-firebird-3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!