Search code examples
c#firebirdfirebird-.net-provider

Firebird error : "operating system directive CreateFile failed" on opening connection


I have narrowed done my problem to small sample where this issue can be easily produced.

Brief - I am using embeded dll's of firebird for database connectivity i.e. fbembed.dll to connect to firebird databases. In code, i have three connection strings like this (note additional attribute client library specified in third connection string) -

private const string connection1 = @"User=SYSDBA;Password=masterkey;Database=D:\DB1.fdb;ServerType=1;Charset=UTF8";
private const string connection2 = @"User=SYSDBA;Password=masterkey;Database=D:\DB2.fdb;ServerType=1;Charset=UTF8";
private const string connection3 = @"User=SYSDBA;Password=masterkey;Database=D:\DB2.fdb;ServerType=1;client library=D:\fbembed.dll;Charset=UTF8";

I have two buttons on UI and on first button click i have this code -

FbConnection fbConnection = new FbConnection(connection1);
fbConnection.Open();

On second button click i have this code -

FbConnection fbConnection = new FbConnection(connection3);
fbConnection.Open();

If i create connection with connection string specified as connection3, i am getting FbException "operating system directive CreateFile failed".

However, if i replace the connection string as connection2, it works fine.

Moreover, if i create connection with connection3 and then with connection1 no issue but in case i create connection with connection1 and then connection3, same fbexception coming.

Note, the database specified in connection2 and connection3 is same but only difference is of additional attribute client library.

Why this strange behaviour with embeded firebird. It all works fine in case i have firebird server installed on my system. But, i want to know the issue why it persists in embeded dll's of firebird?


Solution

  • Your issue is related to: http://tracker.firebirdsql.org/browse/CORE-2507

    This is a bug in FB engine, fixed in 2.1.4 version.