0

I am using Firebird 4.0 with SuperServer installed on Microsoft Windows 2011. I am developing a win64 database application with Delphi to access the database file on a remote computer.

If I connect to the database file with IBExpert while I also try to connect to the same database with the application I am developing, I get the following error message:

[FireDAC][Phys][FB]lock time-out on wait transaction
object D:\MYFILES\DATABASE\SZERYNG\IMOVEIS_FIREBIRD\BANCO DE DADOS\DBIMOVEIS.FDB is in use

I can open more than one IBExpert and connect to the same database file but I cannot connect to the database file with my application if any other application like IBExpert is connected to the same database file.

IBExpert
FDConnection
IBExpert database registration info My application's FDConnection parameters
Database
Database File
D:\MyFiles\Database\Szeryng\Imoveis_Firebird\Banco de Dados\DBIMOVEIS.FDB D:\MyFiles\Database\Szeryng\Imoveis_Firebird\Banco de Dados\DBIMOVEIS.FDB
Server/Protocol
Protocol
Remote, TCP/IP TCPIP
Server Name
Server
127.0.0.1 127.0.0.1
Port 3040 3040
User Name
User_Name
SYSDBA SYSDBA
Charset
Character Set
ISO8859_1 ISO8859_1
Server Version Firebird 4.0
SQL Dialect 3
Client Library File
FDPhysFBDriveLink.VendorLib
c:\windows\syswow64\fbclient.dll c:\windows\system32\fbclient.dll

IBExpert database registration info:

Database File: D:\MyFiles\Database\Szeryng\Imoveis_Firebird\Banco de Dados\DBIMOVEIS.FDB
Server/Protocol: Remote, TCP/IP
Server Name: 127.0.0.1
Port: 3040
User Name: SYSDBA
Charset: ISO8859_1
Server Version: Firebird 4.0
Client Library File: c:\windows\syswow64\fbclient.dll

My application's FDConnection parameters:

Database: D:\MyFiles\Database\Szeryng\Imoveis_Firebird\Banco de Dados\DBIMOVEIS.FDB;
Protocol: TCPIP;
Server: 127.0.0.1;
Port: 3040;
User_Name: SYSDBA;
Character Set: ISO8859_1;
SQL Dialect: 3;
IBAdvanced: set_db_readonly=0;

FDPhysFBDriveLink.VendorLib = c:\windows\system32\fbclient.dll; 

My application does not use the embedded Firebird client. How can I solve this problem?

IMeMine
  • 5
  • 3
  • 1
    Either your Delphi application is using Firebird Embedded, or your IBExpert sessions are. Since Firebird 3.0, it is actually pretty easy to "accidentally" use Firebird Embedded, by referencing the `fbclient.dll` of your Firebird installation (instead of - for example - the one in the Windows System32/SysWOW64 directory) and using a connection string which only consists of the database filepath or alias (no hostname, or one of the new connection URL prefixes). In any case, you will need to post the exact configuration and connection URL used in both IBExpert and your Delphi application. – Mark Rotteveel Feb 13 '23 at 16:42
  • 1
    Error is different. "Lock time-out on nowait transaction" instead of "I/O error during CreateFile (open)". – user13964273 Feb 13 '23 at 22:42
  • Problematic attachment options requested exclusive access to database. Such options may be dpb_disable_wal, dpb_set_read_only, dpb_set_db_replica or dropDatabase(). – user13964273 Feb 13 '23 at 22:50
  • You are still using 127.0.0.1 (which uses the local loopback engine instead of remote). Did you try your real IP address on the local network (for both programs)? – Rik Feb 13 '23 at 22:51
  • @user13964273 Good point, I hadn't double checked the exact error message that happens when you open the file through two different processes. – Mark Rotteveel Feb 14 '23 at 08:32

2 Answers2

0

This error can be caused during attach to a database by Database Parameters Block including one of following options: isc_dpb_disable_wal, isc_dpb_set_read_only or dpb_set_db_replica. Former will throw the error unconditionally the rest only if the connection is not alone.

Also an attempt of dropping of the database with more than one connection will result in this error but I don't think that this is the case.

user13964273
  • 1,012
  • 1
  • 4
  • 7
0

After I have removed from the IBAdvanced parameter of FDConnection the set_db_readonly=0, now my application can connect to the database while IBExpert or any other application is already connect to the same database.

I have included the set_db_readonly=0 parameter in the IBAdvanced parameter of the FDConnection as suggested by the help of FireDAC to set the database as read\write.

IMeMine
  • 5
  • 3