use java to dump mysql database
I am using Ubuntu. I want to use java application to dump the MySQL database.
Below are my code:
String userName = "root";
String userPassword = "root";
String oldDatabaseName = "testing";
String executeCommand = "";
executeCommand = "mysqldump -u "+userName+" -p"+userPassword+" --no-data "
+OldDatabaseName+" > testingbackup.sql";
Process runtimeProcess = Runtime.getRuntime().exec(executeCmd);
int processComplete = runtimeProcess.waitFor();
if(processComplete == 0){
System.out.println("Backup successful.");
}else{
System.out.println("Backup failed.");
}
But, when I run the above program, I always get the "Backup failed" message.
Am I writing the wrong code? And what library/file I need to include in my java application? Any help please.
Copyright License: Author:「KKL Michael」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer. Link to:https://stackoverflow.com/questions/30623495/use-java-to-dump-mysql-database
About “use java to dump mysql database” questions
I am using Ubuntu. I want to use java application to dump the MySQL database. Below are my code:
String userName = "root";
String userPassword = "root";
String oldDatabaseName = "testing";
String
|
Is there any way that to use mysql dump file as a database source file in android? Actually, I have accounts software with database in Mysql. Now I want to read that database file on android. (Eith...
|
I am unable to create mysql database dump. I have tried all the commands in the below question
https://stackoverflow.com/questions/24858436/unable-to-create-mysql-dump-in-mysql-server-5-6-19
But e...
|
How can I import a mysql database dump file (contains insert and create table statements) programmatically through a java program. I need this as the setup phase of a unit test.
Unfortunately this
|
I already export MySQL database.Now i want to know database name present in dump file through java code.I require this because, if database present in dump file is not present in server then first ...
|
I have done the depot application using mysql... Now i am in need to use postgres... So i need to dump data from mysql database "depot_development" to postgres database "depot_develop"...
|
I imported some Wikipedia dump file in a sql database. Everything worked fine. Except the fact that only a part of 3 GB dump is imported into the database (only 1000 articles, with articles beginning
|
Here is my use case:
I have an sql dump file provided by a server application that I don't have access to, neither to the MySQL database that originates the file.
The sql dump file is an ordinary o...
|
I have the following yml file:
version: '2'
services:
# another container
db:
build: ./path/to/dockerfile/
environment:
MYSQL_ROOT_PASSWORD: mypassword
...
|
I wanted to get a second opinion on the below.
What i'm trying to achieve is to dump a mysql database over to a new database on a different server, I also wanted to do it with limited write to the
|
|
|