MySQL Forums
Forum List  »  Connector/Node.js

Re: importing XML file into MySQL
Posted by: Roland Bouman
Date: April 05, 2006 04:51PM

Lev Abramov wrote:

> My question is whether I can import an XML file
> into MySQL directly, or need to further convert it

Yes, sorta. I wrote a bloggie on that: http://rpbouman.blogspot.com/2006/03/importing-xml-data-into-mysql-using.html

However, it involves running MySQL 5.1.6 or up (which is beta) and you'll need some programming experience (fair chance you can reuse almost all of my code in the blog entry)

> first (e.g., open it in MS Excel and re-save as
> .csv) before MySQL (aided by PHPmyAdmin) will
> agree to look at it.

This is actually quite a good idea. Csv imports rather nicely using the mysqlimport utility (http://dev.mysql.com/doc/refman/5.1/en/mysqlimport.html) or the LOAD DATA syntax (http://dev.mysql.com/doc/refman/5.1/en/load-data.html). If you know some other tool that does it for you: go ahead. Regarding the LOAD DATA method, you might want to check out this thread before you start:
http://forums.mysql.com/read.php?10,38173,38256#msg-38256

> the second question is whether a layman like me
> can do it in a fairly straightforward manner, or
> whether I should outsource this to someone who
> knows something about database conversion.

Well, I think you should be allright when you try the csv approach. Just post back if you have some more questions.

> TIA -
>
> Lev

Options: ReplyQuote


Subject
Written By
Posted
Re: importing XML file into MySQL
April 05, 2006 04:51PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.