I am trying to connect to an Embedded firebird database using a .Net 8.0 application.
I create a connection string to an existing database as follows (in server mode) :
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
here all works fine.
Then, I simply replace the server type from 0 to 1 and perform some additional tweaks to connect :
FbConnectionStringBuilder conn = new FbConnectionStringBuilder(_connectionStr);
// next line basically to ensure I'm using Embedded mode...
conn.ServerType = FbServerType.Embedded;
// --- test connection - in embedded mode, should not have DataSource nor password
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();
}
When the Firebird service is still running locally on the machine, I get the following error:
Your user name and password are not defined. Ask your database administrator to set up a Firebird login
So I stop the service – then I make sure I add all necessary files (as described e.g. here). I then get another error:
Unable to complete network request to host "xnet://GlobalFIREBIRD".'
As suggested, I made sure my program and dlls are the same bitness (I tried both AnyCPU or x64, knowing I’ve downloaded the x64 files…) – nothing seems to help.
I even tried to enable legacy authentication modes and so on, but none of my attempts helped. Is it at all possible to connect in embedded mode in .Net 8.0?