If my XML data is very complex, is there a way I can store this in DB?
The most common way to store XML in MySQL is to use the LOAD_FILE() function to open an entire XML document, store it in a variable, and insert the variable into a table column.
"You can store XML in a database designed specifically for XML, in a modified object database, or in a relational database."
It's neither bad or good to do store XML in a DB. You just have to consider your requirements and how the data is used. If your data is machine produced and consumed, and it is only in XML to transport between apps, then a DB makes sense.
To import data from a XML file into a MySQL table, select the table in Object Browser and select Table -> Import -> Import XML Data Using Load Local... or(Ctrl+Shift+X). Tables: The list of all tables of the currently active database is shown. Select the Table from the list box.
The "regular" way is to store XML in a CLOB (Character Large Object) and MySQL supports CLOB with 4 data types:
Using one or the other depends on your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With