found a free oracle database to download
http://www.oracle.com/technology/products/database/xe/index.html
Downloads Oracle enterprise edition 10G.
I am using eclipse so then add
c:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar
to your eclipse build path
public class ConnectionTest {
static public void main(
String argcv []){
Connection conn = null;
String driverName = "oracle.jdbc.driver.OracleDriver";
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
conn = DriverManager.getConnection("jdbc:oracle:oci8:@","hr","hr" );
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM Employees");
while (rs.next()) {
int id= rs.getInt(1);
System.out.println("EMPLOYEE_ID "+id);
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}