File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases and the fly likes Need tool for export/import of database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Need tool for export/import of database" Watch "Need tool for export/import of database" New topic
Author

Need tool for export/import of database

johnny zee
Greenhorn

Joined: Sep 28, 2002
Posts: 7
Basically I just need a java library for exporting the database (schema and data) to a file, and being able to import that file again. I want to use it as a backup feature.

Preferably it should export to a runnable sql script (like mysqlfront's export feature).

It wouldn't be impossible to implement by myself but I am hoping something similar already exists.
Dmitry Melnik
Ranch Hand

Joined: Dec 18, 2003
Posts: 328
Does it really have to be a Java library? What don't you like about the toos which come with the DB?
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
Originally posted by Dmitry Melnik:
Does it really have to be a Java library? What don't you like about the toos which come with the DB?

I agree, most databases have some kind of backup or replication feature. You could probably do it using Java but I think it would be horribly inefficient, unless your db is very small.


Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
johnny zee
Greenhorn

Joined: Sep 28, 2002
Posts: 7
About the OT, I need programmatic control over the export/import functions. And since my program is java the functions should also be written in java.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You could just do a Runtime.exec() to run the particular dump utility, couldn't you?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
johnny zee
Greenhorn

Joined: Sep 28, 2002
Posts: 7
Paul, I need direct programmatic control, and I need the source so I can adapt it to my specific needs if necessary.

Lukas Eder
Ranch Hand

Joined: Jul 22, 2013
Posts: 43
    
    4

Flyway is a fine database migration tool:
http://flywaydb.org

I'm sure it will be able to import / export your DDL and data the way you need


When Java and SQL work together, great software can evolve. That's why we have created jOOQ. Follow me on blog.jooq.org
 
Consider Paul's rocket mass heater.
 
subject: Need tool for export/import of database