XML Databases DOM : XML Database : XML : Java examples (example source code) Organized by topic

Java
C++
PHP


Java  »  XML   » [  XML Database  ]  Screenshots 
 



XML Databases DOM


import java.sql.*;
import java.io.*;
import org.apache.xerces.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;

public class XMLDBDOM {

  public static void main(String[] argsthrows Exception{

      Class.forName("COM.cloudscape.core.JDBCDriver").newInstance();

      Connection conn = DriverManager.getConnection("jdbc:cloudscape:GAMETRADER");

      conn.setAutoCommit(false);

      Statement s = conn.createStatement();
      s.executeUpdate("CREATE TABLE XMLData(GAMEID INT, MANUAL SERIALIZE(org.w3c.dom.Document))");
      conn.commit();

      File file = new File("XMLData.xml");
      InputStream is = new FileInputStream(file);

      PreparedStatement ps = conn.prepareStatement("INSERT INTO XMLData VALUES(?,?)");

      ps.setInt(11285757);

      DOMParser parser = new DOMParser();
      parser.parse("XMLData.xml");
      Document manual = parser.getDocument();
      ps.setObject(2, manual);

      ps.execute();

      conn.commit();
  }
}


           
       
Related examples in the same category
1.  XML Databases and Tools 3
2.   XML Databases and Tools 1: read from clob
3.  XML Databases and Tools 2: read from blob
























Home| Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.