Reputation: 601
I made my database in mySQL and I exported it in a file using mysqldump. Is there a way to make my program on JAVA to connect in mysql and create an empty database with the stracture I saved in the file, only if the above database is not allready exist to the server? Thank you!
Upvotes: 1
Views: 3170
Reputation: 38147
Try something like :
Runtime.getRuntime().exec("mysql -u <username> -p<password> <youdbname> < <youbackupfile>");
you will need to replace <username>
with your username / <password>
with your password / <yourdbname>
with you database name / <yourbackupfile>
with the file you used for backup
Upvotes: 4