Hi, I've two questions about the code accessing the db file:
1) It is correct to check the corrispondance between magic cookie and the current version of the DAO? In my case, for version 2x2, I use readInt (4 bytes) then I compare with 0x0202 (constant of my DAO Class), throwing an exception if it fails.
2) The format of the file is quite unclear on Sun's instructions. Based on this sentence:
Are we always required to check the magic cookie? Or, is this dependent on the assignment. My assignment is the B&S ver. 2.2.3, and nowhere in my assignment can I find anything about checking the magic cookie, its existence is only revealed as part of the database file description.
If I need to check it, how would I know which value I should expect? Is it the value I get when I run it against the file received as part of the assignment?
I'm on B&S 2.2.1 and there's also no explicit requirement to check the magic cookie value. Although I figure it makes a neater solution if your application gracefully handles the situation where a non-B&S data file is selected.
Likewise there's no requirement to handle the situation where your network client can't connect to your server. But it's much neater if you pop up a message to inform the user of this rather than spewing out lots of exception traces.
I hope that helps!
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad: