1

I am using MS access database .mdb file to store the information (10 tables). The file is stored in network folder in G Drive and the G Drive is backed up (via the company server) everyday. I have developed an Java application (Swing/JFrame) which read/write into the database. The application and database are working correctly now.

I am working as an short term intern in the company and the application was developed by myself. What if the database is corrupted or crashed? How can i make it in a way that, if it crashes today then take the previous day data/file and run?

I ask because if the database is corrupted after I leave the company, no one else have idea of what to do?

Could someone recommend/suggest a process to overcome the above scenario?

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
vijay
  • 1,129
  • 7
  • 22
  • 34

1 Answers1

2

To create multiple backup copies of a file, you can use an Automated Task in Windows to copy the current .mdb file to a separate location with a modified filename to indicate when it was copied (backed up). My server uses a VBScript to perform such a task, and the code uses Weekday(Now) to include a numeric value corresponding to the day of the week (1 through 7) as part of the filename. So my backup folder contains files...

crmBackup1.bak
crmBackup2.bak
...
crmBackup7.bak

...and I always have 7 days' worth of backups at my disposal.

If you are asking for a way to have your application automatically detect a corrupted data file and revert to the previous day's backup, that is not a good idea. Depending on the nature of the corruption the data in the current file might be salvageable, so automatically "throwing it away" would be unfortunate.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
  • Do you have any idea to perform the task in java? – vijay Apr 08 '13 at 13:38
  • 2
    @vijay If you're asking about a Java equivalent to `Weekday(Now))` then a question you answered [here](http://stackoverflow.com/questions/12728527/joda-time-add-weekdays-to-date/15339851#15339851) suggests that `.getDayOfWeek()` would be it. If you're asking about how to copy files using Java, answers to the question [here](http://stackoverflow.com/questions/5003907/how-to-copy-file-in-java) offer a number of suggestions. – Gord Thompson Apr 08 '13 at 14:10