execute mysqldump
from java code
Example:
Backup :
Runtime.getRuntime().exec("mysqldump -u USERNAME -pPASSWORD DBNAME > /path/to/location/backup.sql");
Restore:
Runtime.getRuntime().exec("mysql -u USERNAME -pPASSWORD < /path/to/location/backup.sql");