0

Is it possible to back up an access database? I have done research on how to backup access database through php but I wasnt able to get a good answer. Most of the result that came out is about backing up MySQL database. Can anyone help me :) thanks

lexter
  • 225
  • 1
  • 4
  • 14
  • "access database", as in *Microsoft Access*? If so, then are Access databases not just normal files, just like SQLite databases? – Sverri M. Olsen Mar 07 '13 at 10:31
  • @SverriM.Olsen - yes! `microsoft access`. The Database contains information about employees :) – lexter Mar 07 '13 at 11:01
  • Backup as in [copy()](http://php.net/copy)? – Álvaro González Mar 07 '13 at 11:14
  • @ÁlvaroG.Vicario - yeah! i want to automatically back it up – lexter Mar 07 '13 at 11:15
  • I mean, is it possible to create a code that will automatically saved an access database. For example, the database will be backup every week, like that. You dont have to manually back it up. Im using windows 7 by the way. :) – lexter Mar 07 '13 at 12:24
  • That is not something you should do with PHP. I am not sure if there is a `cron` program (a program that executes scheduled tasks) for Windows 7, but that would be the proper way of backing up a database periodically. – Sverri M. Olsen Mar 07 '13 at 12:26

1 Answers1

2

re: actually performing the backup

Backing up a native Access database is simply a matter of copying the entire database file (.mdb for Access_2003 and earlier, .accdb for Access_2007 and later). You could use PHP for that, but any scripting language would work, even a simple Windows batch file that does something like

copy /Y d:\apps\databases\mydatabase.accdb z:\backups\databases\*.*

If you're really set on using PHP then you'll likely end up using the copy() function.

re: automatic scheduling of the backup

The Task Scheduler in Windows could take care of that for you. Once you've created your script to copy the database file(s) you can create a scheduled task to run it periodically. See the MSDN article Using the Task Scheduler (Windows) for more information.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418