public void createXMLFile(String tableName, String sql, String filePath) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@IP:端口號:serviceName", 用戶名, 密碼);
IDatabaseConnection connection = new DatabaseConnection(conn);
QueryDataSet query = new QueryDataSet(connection);
query.addTable(tableName, sql);
XmlDataSet.write(query, new FileOutputStream(filePath));
}
util.createXMLFile("tbl_XXX", "select * from tbl_XXX where fileds in ('','') ", "E://file1.xml");