Hi,
You need to import the javax.sql package in your program and then use the different methods of this class. I am attaching a small code for your reference.
This program assumes that u have a ODBC connectivity to Oracle, it reads the data from table and prints it on console
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:"+yourDSN"+,"scott","tiger");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from anyTableyouwant");
int c =rs.getMetaData().getColumnCount();
while (rs.next())
{
for (int i=1;i<=c ;i++ )
{
System.out.print(rs.getString(i)+"\t");
}
System.out.println();
}