简体   繁体   中英

Migrate Firebird 2.5 to 4.0 using ADO.Net provider

I just upgraded my DB to Firebird 4.0 and all seems to work when connecting to the DB using a database management tool.

So now I try to connect, after making sure I've upgarded my ADO.Net to FirebirdSql.Data.FirebirdClient v8.0.1 (latest).

Here is how I create my connection string (yes, db path exists and I made sure that users have modification rights):

 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();

Now, notice I left out WireCrypt option (on purpose to start with). My error is:

Error occurred during login, please check server firebird.log for details

firebird.log says:

Authentication error No matching plugins on server

So I googled around and found hints it may come from wire encryption. Well ok, so I did try all 3 versions of wire encryption - if I use Required or Enabled , I get the above error. If I use the Disabled , I get

Incompatible wire encryption levels requested on client and server

Furthermore, I tried setting WireCrypt = Disabled in firebird.conf and in my code, restarted the service and tested again - now I have the same result as with the first two cases:

Authentication error No matching plugins on server

So I guess I'm missing something here about the encryption plugins - but I couldn't find any valuable information there, thanks for helping out!

UPDATE: here are the settings I tried and the error I got:

Attempt 1: all firebird.conf defaults (I posted it here to keep things short here):

Connection string 1:

character set=NONE;data source=localhost;initial catalog=C:\Users\DBAccess\MYDB.FDB;user id=SYSDBA;password=masterkey;wire crypt=Disabled

Incompatible wire encryption levels requested on client and server

Connection string 2 (wire crypt=Enabled or Required)

Authentication error No matching plugins on server

Attempt 2:

WireCrypt = Disabled

Connection string 1:

character set=NONE;data source=localhost;initial catalog=C:\Users\DBAccess\MYDB.FDB;user id=SYSDBA;password=masterkey;wire crypt=Disabled

Authentication error No matching plugins on server

Connection string 2 (wire crypt=Enabled) => same error!

Attempt 3:

AuthClient = Srp256, Srp
UserManager = Srp

Connection string 1:

character set=NONE;data source=localhost;initial catalog=C:\Users\DBAccess\MYDB.FDB;user id=SYSDBA;password=masterkey;wire crypt=Disabled

Incompatible wire encryption levels requested on client and server

Connection string 2 (wire crypt=Enabled or Required)

Authentication error No matching plugins on server

Attempt 4:

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

Connection string (same result with any wire crypt option in the connection string):

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

Authentication error No matching plugins on server

NOTE: I also see the following message in firebird.log , which is possibly due to the service restart...

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

The Firebird ADO.net provider version 8 only supports the Srp authentication plugin when connecting to Firebird 3.0 or higher, but Firebird 4.0 by default only uses the more secure Srp256 plugin. You will need to change the AuthServer setting in firebird.conf to Srp256,Srp for the Firebird ADO.net provider to be able to connect.

See also this issue: Support for Srp256 [DNET942] #864

Ok, I eventually got it to work using following settings:

firbird.conf :

AuthServer =  Srp256,Srp
UserManager = Srp
WireCrypt = Enabled

And connection string code:

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;

Use AuthServer = Legacy_Auth on firebird.conf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM