//  by Arul John

import java.sql.*;
import java.io.*;

public class SimpleOracle {
    private Connection con;
    private boolean flag;

    public SimpleOracle() {
    } //

    public void getConn() {
	try {
	    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	    con = DriverManager.getConnection("jdbc:odbc:xmldbms","arul","arul");
	} catch(Exception e) {
	    System.out.println("Sorry, couldn't connect to the database");
	}
    } // get the database connection first

    public void startQuery() {
	try {
	    Statement st = con.createStatement();
	    ResultSet rs = st.executeQuery("select * from person");
	    while (rs.next()) {
		System.out.print("ID# " + rs.getString("userID") + " ... ");
		System.out.print("Name : " + rs.getString("city") + " ... ");
		System.out.println("Age : " + rs.getInt("country"));
	    }
	} catch(Exception e) {
	    e.printStackTrace();
	}
    } // access the database

    public static void main(String args[]) {
	SimpleOracle s = new SimpleOracle();
	s.getConn();
	s.startQuery();
    }
}
