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.