• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Choosing the database file

 
Amit Kr Kumar
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Team
In my assignment solution, i am allowing the user to specify the database file with location using FileDialogBox in local mode. The user can choose any .db file which has the correct format. This means that the database file name need not be db.db. It can be abc.db or db30july.db etc. But extension should always be .db
This provides more flexibility.
Is it correct ?
Should i ask user to only specify the location/directory of the database file and i assume the database file name always to be db.db
How others have handles it ?
[ July 17, 2002: Message edited by: Amit Kr Kumar ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can definitely provide that flexibility.
Do you handle the situation of the usrer selecting an invalid file that is not a db file, and when it tries to open it, it throws an exception?
Mark
 
Amit Kr Kumar
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark
Yup i have handled itas Data.java will throw IOException if it is not in expected format

Amit
 
friso dejonge
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I do not think this is in the requirements. Think of a situation when you are in a customer situation, would you build it as well, even if the customer did not include this in the requirements and will therefore not pay for it ?
I agree however that this project is more about learning java/patterns etc and not about a client situation. Therfore if you want to do it, just go ahead, but indeed do as mark S. says, make sure you have exceptions handled. Also make sure that your views work with different models / database layouts, that if you open another db file with
different fields, that everything still works.
good luck
regards,friso
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that if you open another db file with
different fields, that everything still works.

It doesn't need to work with a db that has different fields. And yes this can be construed as extra work, but the JFileDialog is easy to implement, and won't hurt his points.
Mark
 
Amit Kr Kumar
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark
But how to determine whether selected db.db has the expected fields in it, though this can be checked whether it is in the format expected by Data class
Amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic