The XMLtoInputStream() example
The following example inserts an XML file into a text
column. In this example, table tab2 is created with the SQL
statement:
create table tab2 (col1 text);
The
code is:
try { String cmd = "insert into tab2 values (?)"; PreparedStatement pstmt = conn.prepareStatement(cmd); pstmt.setAsciiStream(1, UtilXML.XMLtoInputStream("/tmp/x.xml"), (int)(new File("/tmp/x.xml").length())); pstmt.execute(); pstmt.close(); } catch (SQLException e) { // Error handling }