Reputation: 1
i have got a database which lists actors and movies, these essentially come from two different arrays. I now need to save these from the database into a text file. I don't know if anyone can point me in the right direction, i was thinking filewriter or maybe bufferedwriter?
Upvotes: 0
Views: 1128
Reputation: 8710
you can use the mysqldump command. Then you can dump as text the whole DB or isolated tables.
Upvotes: 1
Reputation: 18445
Can't you just select the data and dump it to file? SHould be pretty trivial from the command line, no coding required!
mysql -u username -p -D databasename -e "select * from actors" > actors.txt
Upvotes: 1
Reputation: 13041
If you want the data readable in a text file, one easy way to do it is to write the data as a CSV (comma-separated values) file. There are a couple of libraries for reading/writing CSV files. I've used opencsv before, and it's quite easy.
Upvotes: 1