I don't know which Java development tool you are using (I'm using Eclipse) but I can provide you a basic Java-Oracle connection example.

All you'll need is classes12.jar; the file must be imported in your Java project. You can find it in your \\ORAHOME\JDBC\LIB directory.

Then you can do this:

----------------

import java.sql.*;

public class FirstExample {

public static void main(String[] args) {
try {
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

Connection conn = DriverManager.getConnection("jdbc: oracle:thin:@localhost:1521:RESEARCH","scott","tiger");
// jdbc: oracle:thin - JDBC driver
// localhost (it also accepts IP)
// 1521 - port
// RESEARCH - SID
// scott - username
// tiger - password

Statement stmt = conn.createStatement();

// a select query
ResultSet rset = stmt.executeQuery ("SELECT ename FROM emp");

while (rset.next()) {
System.out.println("ENAME = " + rset.getString(1));
}

rset.close();
stmt.close();
conn.close();

} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
}
}
}

--------------------

Works for me, the result is

ENAME = SMITH
ENAME = ALLEN
ENAME = WARD
...
...

Samo Decman