Thursday, October 11, 2018

Using WebRowSet to create XML file from JOBS table

 


import java.sql.*;
import javax.sql.*;
import oracle.jdbc.rowset.*;
import java.io.*;

public class WebRowSetDemo {
    public static void main(String[] args) throws Exception{
        OracleWebRowSet rs = new OracleWebRowSet();
        rs.setUrl("jdbc:oracle:thin:@localhost:1521:XE");
        rs.setUsername("hr");
        rs.setPassword("hr");
        rs.setCommand("select * from jobs");
        rs.execute();
        // write to XML
        FileWriter fw = new FileWriter("c:\\jobs.xml");
        rs.writeXml(fw);
        rs.close();
    }
}

No comments:

Post a Comment

CORBA Java Tutorial using Netbeans and Java 8.

CORBA-Example A simple CORBA implementation using Java Echo.idl module EchoApp{ interface Echo{ string echoString(); }; }; ...