Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database File Format

 
Travis Zimmerman
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone taken care of the case where a user would try to open the wrong type of db file( ie .bat or .xls ). There is no default handling of this in the Data file and the results are undefined.
Travis
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Travis,
Why give a user the option to open the wrong file type? Since we already know the name of the database (ie db.db) why not simply use that given to "idiot-proof" the database bootstrap code? For remote mode, the database should probably be in the same directory as the server and for local mode in the same directory as the client. By doing it that way you remove any chance of selecting an invalid file. You simply start the database without any user input.
That's my opinion anyway
Michael Morris
 
Najib Coutya
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to allow the user to launch the server with the database file s/he wiches to use.
In case the user enters the wrong database name, the data file will fail to open resulting in an exception which should be handled and dumped properly on the screen where the user tried to launch the server from.
 
Travis Zimmerman
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the exceptions should be caught. However, any number of exceptions could be thrown, in any number of places. This will not neccessarily happen on the open but most likely some part of the read. I was only curious if anyone had come up with a graceful and simple way of handling them all.
Travis
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic