This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm still not clear on what should be done with this cookie value.
I get the impression from reading previous threads that the cookie value is used to determine that a file is valid database file or not.
So what should I do in my application? Does every valid database file use the SAME cookie? If so I guess I could check to make sure the file has the appropriate cookie value when I first open it up for access. Is this the right thing to do?
Joined: Jan 27, 2004
You can do whatever you want with it. There is no MUST to do anything with the cookie value. Some people (like me) have decided to hardcode it in and use it to verify a database file. I'm sure there are other people who chose not to do anything with it (I was about to do that, but I figured one line of extra code couldn't hurt).
If you are not already aware of this, there are multiple assignments, and multiple versions of the assignments. Some of the variations in the versions of the assignments do include changes to the database structure. For example, some databases have a two-byte "deleted" flag, while others have a single-byte "deleted" flag. There are many more differences as well.
So even if two candidates are working on the contractors assignment, the database formats may be completely different. In such a case, though, the cookie values will be different.
I personally feel that you must validate the cookie value, as not all the database structural changes will be catered for in the meta data.