Java App for PostgreSQL scheduled backups using pg_dump (Windows only) 9

Today I’ll show you an easy way to automate your database backup dumps with a java application that runs on the background. This simple app will generate a backup of your database and will name it with today’s date. It’s not really the java program interacting with the database, but the app interacting with the command line program pg_dump.

The thing is quite simple. First we generate a filename with today’s date. Then we check if the file exists. Finally we call the pg_dump with the appropriate parameters and the backup is generated

To run the above programs you will need to have pg_dump.exe and the necessary dll files in the backups directory. We can also schedule the task to be run once a day so we can have a fresh backup every night.

Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Pin on PinterestEmail this to someone

Leave a comment

Your email address will not be published. Required fields are marked *

9 thoughts on “Java App for PostgreSQL scheduled backups using pg_dump (Windows only)