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 magic mySQL to XML piece??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "magic mySQL to XML piece???" Watch "magic mySQL to XML piece???" New topic

magic mySQL to XML piece???

Chris Snapp

Joined: Nov 14, 2003
Posts: 16
I'm about as green as you can get so I'm sorry if this is a well known issue (searching the web and forums hasn't gotten me anywhere).
My goal is to retrieve data from a mySQL database in XML format and allow this XML to be stored in a bean or sent back to the browser either raw or through a stylesheet transformation.
I figured the DB to XML jive was a pretty common issue, but I haven't been able to find any half-way straightforward explanation that I could get to work.
I had stumbled across "DB2XML" but for the life of me I couldn't figure out how to work the durn thing. (like I said....I'm still a newbie to JAVA)
Any help would be greatly appreciated.
cyril vidal
Ranch Hand

Joined: Jul 02, 2003
Posts: 247
you may use mysqldump utilitary to do it automatically. by example:
C :\%mysqldump% -X test transactions > c :\resu.xml
will extract into resu.xml the table transactions from database test.
or you may find this tutorial interesting too:
using JDBC to extract data into XML
And because this forum deals with Servlet, and if you read french , you may want to have look to this article, that extracts data from a database with a servlet and outputs it in XML, HTML and finally SVG.
.Servlets, base de donn´┐Żes et SVG

[ November 16, 2003: Message edited by: cyril vidal ]

SCJP 1.4, SCWCD, SCBCD, IBM XML, IBM Websphere 285, IBM Websphere 287
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Moving from Servlets to... um... JDBC.
I agree. Here's the link:
subject: magic mySQL to XML piece???
It's not a secret anymore!