It's not a secret anymore!*
The moose likes JDBC and the fly likes exporting mysql into xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "exporting mysql into xml" Watch "exporting mysql into xml" New topic
Author

exporting mysql into xml

bryan lim
Ranch Hand

Joined: Dec 26, 2008
Posts: 140
hi all,

i am not sure should i be asking this in this forum.

anyway, I want to export the data from mysql into xml. i am not sure what is the best way to do it? i googled and realised that PHP can do it but i am not good at it.

is there a recommended solution or a java way to do it?

thank you
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
hi buddy you can use the following console command


mysqldump --xml --databases your database name -u username -p password >test.xml

after execution the file named test.xml can find on your mysql>bin> diretory ok

"Helping hands are better then praying lips"

<919998971048>


Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

I've seen questions like this, and the simple answer is, you need to write a software program, possibly a short JDBC one, to do it. You can export the data into a flat format like CSV or as a database backup, but if you're looking for a more meaningful XML interpretation, databases simple aren't equipped to handle it. For example, consider normalized data where you might have a country id instead of a country name. Inside of a database, it makes sense to reference a country by a fixed id, but exported to XML you might want to resolve it to a name, or a code for the country. In short, there's nothing simple about building an XML out of a database unless you are using especially flat data.


My Blog: Down Home Country Coding with Scott Selikoff
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

"ytbryan lim"

Please consult the naming policy in regards to your screen names.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exporting mysql into xml
 
Similar Threads
Parsing XML from a String
JPA/Hibernate: Selecting data from second database?
How to read data from an XML file and store it into database(MySQL) ?
avoid inserting empty string
XML -> SAX -> MYSQL conversion losing character encoding...