Question

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?

Was it helpful?

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.

OTHER TIPS

The problem is that you are connecting to database with Firebird server and Firebird embeeded. The first one locks the database file for open with other proceses(i think you are using superserver).

Another option is that you are using two fbembed.dll from different locations.

This is rather funny but I fixed my Firebird 1.5 + Windows 7 problem! Installed Firebird as application then ran fb application as admin and the batch file (gbak.exe -b -v -g) also as admin. Got rid of:

**ERROR**:uavailable database
or
operating system directive CreateFile failed
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top