It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes exporting mysql into xml 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 "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> <+918866008962>
"Helping hands are better than praying lips......"
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

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.


[OCA 8 Book] [Blog]
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

"ytbryan lim"

Please consult the naming policy in regards to your screen names.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: exporting mysql into xml
 
It's not a secret anymore!