|
* 查询xml列数据,用于验证 * * @throws SQLException */ public static void testQueryXMLColumn() throws SQLException { String query_sql = "SELECT INFO FROM Customer"; Connection conn = DBUtils.makeConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query_sql); StringBuffer xmls = new StringBuffer(); while (rs.next()) { xmls.append(rs.getString(1)).append("\n"); } System.out.println(xmls.toString()); stmt.close(); conn.close(); }
/** * 测试入口,方法组调用 * * @param rags * @throws Exception */ public static void main(String rags[]) throws Exception { testDropXMLTable(); testCreateXMLTable(); testInsertXMLTable(); testQueryXMLTable(); testUpdateXMLTable(); testQueryXMLColumn(); } }
三、运行结果
<out xmlns="http://posample.org"><name>Robert Shoemaker</name></out>
<customerinfo xmlns="http://posample.org" Cid="1002"><name>Jim Noodle</name><addr country="Canada"><street>1150 Maple Drive</street><city>Newtown</cITy><prov-state>Ontario</prov-state><pcode-zip>Z9Z 2P2</pcode-zip></addr><phone type="work">905-555-7258</phone></customerinfo>
Process finished with exIT code 0
呵呵,终于看到运行结果了。
上一页 [1] [2] [3] |