I'm creating a Java application with MySql because the database. I must dump the MySql database from the application periodically(let say every single day at 10 a.m.) and that i wrote a load (.softball bat) apply for dumping the database. The batch file is working fine, but however , it's requesting password every time throughout its execution.
Can there be in whatever way to dump MySql database without compelling for password and get it from Java application periodically?
You are able to certainly place the password around the command line, as others have stated. So far as setting it up to operate from Java (although the purists may object), you should use Runtime.professional() to simply call your mysql command: http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html.
If you are doing the work from inside your java application, you could also be thinking about not only doing the work periodically, though. Based on your database usage (for example frequent reads, but infrequent creates), you might find that you could dump only when you are aware the database continues to be transformed, or something like that along individuals lines.
If you want to simply dump the database periodically though, you may be best just establishing a cron-job. Here is a previous publish on SO concerning the Home windows method of cron: http://stackoverflow.com/questions/132971/what-is-the-windows-version-of-cron.
You will want the next choice for mysqldump
You do not tell the way you are really dumping the database, but I'll assume that you're using mysqldump.
You are able to specify the database password around the command line while using switch
--password=.... Or if you wish to become more secure, make use of a password within an option file. See
man mysqldump to learn more.