DBEV Files Corrupted? Acts empty, file size unchanged.

I was working on a database editing tool at home, transferred via thumbdrive from home to work, and back to home. Go to work on it again tonight and though I can open the databases, they all appear empty. For instance, I have a catalog of all PMS Colors with a name, and a CMYK value. It’s about 300k in size… as the title says the files size has not changed and prior to tonight I have opened, closed, edited, added and deleted individual records without a problem.

But also tonight a different database seems to have disappearing records. Not frequently but I can add it, save, close database, open, retrieve record, view it, close database. Try again and it’s missing. No delete command in the mix. Are the .dbev files fundamentally flawed? Is there a database alternative I can use with applescript? I would like to avoid text files, because I would imagine after a large amount of data is collected they could be come rather slow. Thoughts?

Sqlite3 is probably your best option. man sqlite3


This is discomforting to hear. :confused:

It would be very interesting to see your code, to figure out as to why it happens that the records seems to disappear, as it is quite discomforting if it is so, I have never experienced it myself, not that I have used database events that much, but I have used it for various purposes. I have tried to google the subject, but I can’t find anything like it. What is below the Database events is an sqllite file. Maybe you also could see if you can access the data through sqllite like adyazdone suggests, but maybe you could also try to write another script to access your data?

There may be other reasons for the data not to show up, if they appear the first time, and not the second. So your database file may be intact, and database really working as it should, with the culprit to be find elsewhere. Unless of course, you are 100% confident that your code is flawless in all situations.


I was just reading about Database Events app and it says that it automatically creates the new database in the Documents folder. Also, if you don’t save the changes to the database before the app quits, then you’ll lose changes. Also, the app quits by default at 5 minutes. You can change these properties.


Thanks Kel, I never knew that database events application quits after 5 minutes. Not that I ever use the not-to-usefull app but still I would wish that it keeps running until I shutdown the machine or tell the application to quit.

Back to TS: I don’t think data will be lost completely, database events doesn’t work like property lists in System Events (what you change is immediately saved into the file). After your changes you need to confirm a store to an file. While the database stored in memory can be filled with data, the file can be empty and need a confirm from you to dump the memory into a file. This can be wile you’re closing the database with close saving yes command or just save command (at the end of your script).

All xxxx Events applications (System Events, Image Events, Database Events) quit automatically after 5 minutes of idle time. They all have a read/write quit delay property

I just want to say, that if it works, as it should, and it always has for me, then database events, if not good for complex solutions, like relational tables. It is still a huge step in the right direction, when it comes to queriying your data.

And maybe it also is a tad safer to work with, at least during development, than the technologies you must compare it with: Applescript records and property list files.

I am not saying that the speed is ideal, I don’t know if the items are indexed internally by database events to speed up queries. But it seems to work all right for around 60 records at least.

Maybe it also acts sanely, on queries by date, not year. :slight_smile:

I appreciate all of the feedback, thank you for the time. I wish I had spent a little more time examining my code before posting.

I found the error, and it came from making 2 mistakes. One, after opening a database, i was referencing that database by its index number instead of it’s name. Then to put the nail in the coffin one of my closing functions was mis-named and was closing a different database by name. I didn’t catch it before because of course it was wrapped in a try block.

As someone mentioned before finding information through various google searches was not proving very effective. So hopefully in my ignorance someone stumbles across this and is able to troubleshoot something they didn’t see before. Thanks folks