File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Export data from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Export data from database " Watch "Export data from database " New topic

Export data from database

Maneesh Chauahn
Ranch Hand

Joined: Mar 06, 2006
Posts: 48
Hi All,
I am just writing a small application that takes the back up of the mysql database and write in a file in any format (most probably in the .txt format)

After taking the backup , i want to retrive the data from that file and export the data in the mysql database

If please someone suggest how to a write this application in a good and optimized way .
More over if some one suggest some open free source so that i will get good idea....

Thanks in advance ...

Maneesh Chauhan
sinasi susam
Ranch Hand

Joined: Jul 15, 2005
Posts: 67
Firstly i just did not understand your question very much...

1- you want to take a back up of mysql db and later you wanna insert all into db right?

2- My sql is storing db as files somewhere in its folders.
If your aim is only for back up then why don't you copy the files to somewhere and later copy the files to the mysql's folder that it uses from, as db? I mean manually...

As i said i had a couple questions, I was not sure about what you mentioned exactually.

If in any case you wanna store the datas to files (programatically) and later you wanna insert them into mysql again,

You can use serialization.

You create a javabean which will hold the data .
you persist data with that java bean into disc.
And you can retrieve it later too.

[ September 23, 2006: Message edited by: sinasi susam ]
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Take a look at the mysql client utilities mysqlhotcopy and mysqldump.
I agree. Here's the link:
subject: Export data from database
It's not a secret anymore!