How can we store data from XML to oracle db?

2 views
Skip to first unread message

Ajay

unread,
May 30, 2008, 9:53:57 AM5/30/08
to abhi_and_friends
how XML data gets stored into Database?

Divakar Rai

unread,
May 30, 2008, 2:02:03 PM5/30/08
to abhi_and...@googlegroups.com
Hi Ajay,

The XML Data can be written to an Oracle DB by writing a small program using
a prgram in Java {preferred} or in any other language for interfacing Native
Oracle code.

Easiest approach is making the use of the API provided by Oracle and using
it in a Java Program to Store your XML.

Eg.

OracleXMLSave can be employed to store our XML document in an
object-relational model; the insertXML method performs the actual insertion
of the data.
import java.sql.*;
import oracle.xml.sql.dml.OracleXMLSave;
public class testXMLInsert
{
public static void main(String args[])
throws SQLException
{
Connection conn = getConnection("scott","tiger");
OracleXMLSave sav = new OracleXMLSave(conn, "scott. FXTRADE");
// Assume that the user passes in this document as 0-arg
sav.insertXML(args[0]);
sav.close();
}

...
}


Cheers,

Div.

Reply all
Reply to author
Forward
0 new messages