Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What if the ***.db file itself is missing?

 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
This is a very big mistake that will never happen ideally but has someone thought of this one?
What if the database file itself is not present? This could happen if the user keys in a wrong address for the Database file. Where do we stop the user from using the application?
The server and client are both independent and so in my program at max i can stop the server but what about the standalone mode?
Any hints on this one?
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the file doesn't exist you can't connect to it so you display an error message.
The user can then try again.

Should be no different in each of the three modes.
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay so that exception goes all the way to the client right. But that also means that i need to check for this DBFile Not being Found in all the method calls :-(
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not really, just at the place where you connect.

I'd consider the scenario where the database file gets deleted while the program is running to be one where an application crash is warranted.
If you have to allow for that you'd also have to program against a missing classfile at runtime for example.

What does happen (at least in my implementation) is that if a database operation fails an exception gets propagated up to the client and a message displayed to the effect.
That would be automatic, you already have to deal with IO exceptions after all.
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm.. I get the point. Thanks for the help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic