Help, I'm losing data?
Here are the possible reasons:
1. You are not commiting transactions. Symptom is that everything seems to be there (even for days) until user closes the application once. After that, a lot of data seems lost - rightfully so, as it has gone into the void.
2. You are not using forced writes. When forced writes are not enabled, it is left to operating system to write the changes from filesystem cache to the disk when it decides it is reasonable (this improves performance, but increases risk of lost data). If can easily happen (esp. with some earlier Windows versions) that your data never gets to the disk drive.
3. You are writing data to a temporary table. Since Firebird 2.1 there is a feature called Global Temporary Tables. These tables can optionally delete the rows after transaction has ended, or, alternatively, after connection has ended. Therefore, it might look like data is there while you work, and even after you commit, but as soon as you disconnect the data is really gone.
4. You lost some data on Linux? On Linux, the filesystem behaves differently than on Windows and many newcomers are completely unaware of the following issue: you can freely delete or move the database file open by Firebird server (or any other process). It will keep running without noticing and still be writing at the old file - even if it's 'officially' deleted. Example, you have a database file in:
You connect to it and do some SELECTs, etc. Then you log in as root user and move the file to /dbases/old.fdb. The connection still works and you can select, insert, update, and do whatever you want.
Now, we can create a new database (or move some other file) to /dbases/database.fdb. A new user can come in and establish connection. The old one would still be working as if nothing changed. All this time you get absolutely no errors from either Firebird or your applications. It's a disaster waiting to happen.
To prevent this, make sure nobody is using the database file when you delete or rename it. Useful tools for that are fuser and lsof. Make sure you run fuser at root user, otherwise it will simply tell you whether you are using the database file - and not whether anyone is using it. The fuser command returns the PID (process ID) of the program using it and you can use 'ps ax' command to determine which process it is (probably Firebird server).