Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

DBAccess interface

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have a question about the DBAccess interface,
My intentions are to create a simple database (basically a hashmap in memory) at the server which shall hold the information from the .db file, with one instance of this per client. I want to read information from this database to the GUI and persist all changes made to these databases to the db file.

My problem is that looking at the file I am not sure I can do this. For Example:

"//Reads a record from the file.
//Returns an array where each element is a record value

public String [] readRecord(long recNo) throws RecordNotFoundException;


Looking at the comments I believe that I must use this to access the .db file directly, and that im not allowed to use a database in memory.

Am i interpreting this incorrectly and if so what do you think my options are?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had similar requirements in my assignment, but I did implement a cache in my data store class. I made sure I did not have stale data in my cache (writing data to the file AND the cache).
It turned out to be OK, I got 40/40 in the data store part.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I believe you will have something like "only one application will have access to the data file at a time" in your instructions.html. I found this to be rather contrary to the "you may not change the data schema as other applications utilise the data file", however I guess these applications only have read-access.... An interesting thought is also that if other applications have write access to the data file, it completely invalidates the locking

Anywho.... Since you have exclusive write access to the data file, as long as you update your data cache when you perform writes, you can be sure that the cache sports accurate data.
 
sean mc cusker
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some v valid points there. Thanks for you help, im more sure now about my solution.
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic