Open firebird-automations opened 17 years ago
Commented by: Erik LaBianca (erik_ilsw.com)
There's a pretty easy workaround for this. Mark the file in your filesystem as read-only, after using gfix to set the database as read only.
I tracked it down in the source, the background information is as follows. The database engine (at least on windows) first tries to open a given database in read/write exclusive mode. If that succeeds, it will note the read/only flag on the db in particular but will never release the lock and get a read-only lock. If the attempt to gain a read/write exclusive handle fails, the engine falls back to a read-only open. It then checks to see if the database has been flagged as read-only, and throws an exception if it is not.
IMO there would be some benefit to opening the DB in read-only mode first, then reopening in RW mode IFF the database has not been flagged as read only. This would allow read-only databases to be opened multiple times without jumping through hoops such as storing them on read-only media or setting read-only flags on them.
Commented by: Adam Siwon (traptak)
Thank you very much. This is the best solution for me. I can set read-only attribute during installation. But I think, this feature should be described in documentation. I have checked them and only found information that database is exclusive locked when application use Firebird embedded.
Submitted by: Adam Siwon (traptak)
I'd like to work with Firebird Embedded without database exclusive locking if database is set up to read-only mode. If it is possible...