/* - - - - - - - - - - - - - Code Begins Here :XmlWriteToDb.java - - - - - - */
/*
* XmlRWriteToDb: Code Example to read the file NestedSample.xml created
* by XMLReadFromDb and transfer the conents into the
* nested Table NESTED_SAMPLE_INSERT
*/
package XMLSamples;
import oracle.xml.sql.dml.*;
import java.sql.*;
import oracle.jdbc.driver.*;
import oracle.jdbc.*;
import java.net.*;
public class XmlWriteToDb
{
public static void main(String args[]) throws SQLException
{
String tabName = "NESTED_SAMPLE";
String fileName = "./home/456426/XML/NestedSample.xml";
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection Conn =
DriverManager.getConnection("jdbc:oracle:thin:user/pwd@serveur:1521:instance");
OracleXMLSave save = new OracleXMLSave(Conn, tabName);
URL url = save.createURL(fileName);
int rowCount = save.insertXML(url);
System.out.println("successfully inserted "+rowCount+
" rows into " + tabName);
Conn.close();
}
}
/* - - - - - - - - - - - - - Code Ends Here :XmlWriteToDb.java - - - - - - */
Partager