Showing posts with label java to database. Show all posts
Showing posts with label java to database. Show all posts

Thursday, 16 June 2016

JDBC PROGRAM TO WORKING WITH WEBROWSET

import javax.sql.*;
import javax.sql.rowset.*;
import java.io.*;
import com.sun.rowset.WebRowSetImpl;

class WebRowSetExample
{
public static void main(String[] args) throws Exception
{
WebRowSet wrs=new WebRowSetImpl();

Class.forName("oracle.jdbc.driver.OracleDriver");

wrs.setCommand("select * from registration");
wrs.setUrl("jdbc:oracle:thin:@localhost:1521:xe");
wrs.setUsername("cloud");
wrs.setPassword("cloud");
wrs.execute();

FileWriter fw=new FileWriter("D:\\oracle.xml");

wrs.writeXml(fw);
}
}