Subject The process cannot access the file because it is being used by another process
Author Joe Martinez
I have a customer who is experiencing the above error. This is a replication application that connects to a main replication database, plus several remote databases to sync the data.

The application has a "restart" procedure that occurs when it is having too many connection problems. It does the following:

1) Disconnects from replication DB
2) Disconnects from each of the remote DB's and deletes their objects (IBO TIB_Connections)
3) Reconnects to the replication DB
4) Recreates the TIB_Connection objects (remote connections are opened as needed in the replication loop, so not immediately reopened here)

Steps 1 and 2 complete fine, without raising any exceptions. The customer emailed me a log file, and on step #3, they get the following error:

ISC ERROR CODE:335544344
ISC ERROR MESSAGE:I/O error for file "D:\SMRDBS\DATA\REPQ.FDB"
Error while trying to open file
The process cannot access the file because it is being used by another process.
ERRCODE = 335544344
ErrorCodes = 335544344
2188915362
Sender = TIB_Database
SQL =
SQLCODE = -902
SQLMessage = SQL ERROR

What could cause this?

This is Firebird 1.0

-Joe