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[] args) throws 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(1, 1285757);
DOMParser parser = new DOMParser();
parser.parse("XMLData.xml");
Document manual = parser.getDocument();
ps.setObject(2, manual);
ps.execute();
conn.commit();
}
}
|