• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validation for database file

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi All,

First of all I would like to know that

Sun accessor can check our application with any database file ?
or they will check our application with the database file that Sun provided ?


What are the validation for the database file we should do before starting application?

I am doing the following validation for database file before starting application:

1.correct magic cookie
2.readable file
3.writable file
4. should exist
5. should ends with *.db



I know the magic cookie for my database file so I hard code since without reading file how can we know the exact value of magic cookie so I hard coded in constant file . is it okay?


Am I missing some validation for database file ?



Please let me know.


Regards,
Pramod
 
Ranch Hand
Posts: 147
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

pramod karnani wrote:
Hi All,

First of all I would like to know that

Sun accessor can check our application with any database file ?
or they will check our application with the database file that Sun provided ?


What are the validation for the database file we should do before starting application?

I am doing the following validation for database file before starting application:

1.correct magic cookie
2.readable file
3.writable file
4. should exist
5. should ends with *.db



I know the magic cookie for my database file so I hard code since without reading file how can we know the exact value of magic cookie so I hard coded in constant file . is it okay?


Am I missing some validation for database file ?



Please let me know.


Regards,
Pramod



Perhaps too much validation... the magic cookie is itself enough validation. Here is my sequence of file validation I did.
1. GUI allows user to select file from current directory and does a default display of all files that end in .db This means that this application is not tied to files that end with .db but uses .db files as default. File should be readable and writable yes. I hardcode the magic cookie lower down as a validation but as a means of protection (due to this db being share by legacy application) I ALSO ensured that schema matches so that this application ill not create corrupt data for any existing application using the same database.
 
Ranch Hand
Posts: 221
Scala Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please also check the FAQ for Why do we care about the magic cookie?.


Hope this helps,


Carlos.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic