(Sorry that this is months later, maybe it will help someone else.)
You're more likely to see JET_errAttachedDatabaseMismatch
during development. It is often caused by deleting some of the ESE-generated files, but not all. If you delete the database, you also should delete the log files. This scenario is common during development, when you try deleting the database, but may forget to delete the other files.
When a new database is created, there is a signature associated with it (a timestamp and a random number). You can dump this with esentutl -mh foo.edb
. The transaction log files keep track of the signatures of the databases it references. If you copy in an identically-named database file from a different machine, the signatures won't match. This mismatch can sometimes show up as JET_errAttachedDatabaseMismatch
(but there may be other ways for it to bubble up).
JetInit
is a bit misnamed. It initiates log-file replay. If you have all of the log files from generation 1, the database engine can re-create the database file completely.
Hope that helps,
-martin