tags:

views:

430

answers:

2

Hey Guys! I found you all very helpful.

I am using MySql 5.1 and Java. I have a big XML file and need to fill the data of XML file to MySql table.

For MySQL 5.1 there is a procedure (Using XML in MySQL 5.1 and 6.0), but when I try it in my database, it shows no error but on the same side it has no effect. Can anybody help me?

It will be better if you provide me with a brief example.

The LOAD XML statement is not available before MySQL 6.0.

Thanks

A: 

You'll probably need to write a quick script to parse the XML file and generate sql queries?

The only thing I can think of to try is PHPMyAdmin, I think it can import XML, but there will be filesize limitations, and you say big XML!

benlumley
A: 

Another great way to do this is to use DBUnit but first you have to transform your XML data using an XSL Stylesheet into something that:

a. Matches your Database Schema b. Something that DBUnit can understand

Also make sure you use a C++ programmed XSL transformer to do the transformation as it will allow you to work with larger sets of data than a Java-based one without increasing the size of the stack for Java (also it's faster).

If you need an example of how to use DBUnit checkout Matt Raibles Appfuse Project.

leeand00