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://Global\FIREBIRD".'
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?
plugins/engine12.dll(Firebird 3.0 embedded), orplugins/engine13.dll(Firebird 4.0 embedded)?fbclient.dllin the application directory, if that is the case, it must also have aplugins/engineXX.dllin your application directory (and possibly some additional supporting libraries). It can also mean it is loading a differentfbclient.dllthan you expect because it is in the wrong location compared to the built executable (and for example loads the client-only fbclient.dll in %WINDIR%\System32).Assembly.LoadFile("fbclient.dll");(I tested the file exsits). I getBad IL format.error although both my application and the library are in x64... I even tested to load thefbclient.dlllocated in the Program Files folder - same result!