import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * @author mwood
 */
public class TestOracleConnexion {

	public static void main(String[] args) {
		String url = "jdbc:oracle:thin:@localhost:1521:db1";  // db1 is the SID, a.k.a. Oracle System IDentifier! Your database's SID will be different!
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
		} catch (Exception e) {
			System.err.println("Failed to load JDBC implementation driver");
			return;
		}
		try {
			Connection con = DriverManager.getConnection(url, "test_user", "test_password");
			Statement select = con.createStatement();
                        // The test_user user/schema happened to have a
                        // table named test_table in my database; you may instead
                        // want to "select * from tab" or "select sysdate from dual".
			ResultSet result = select.executeQuery("select * from test_table");
			while (result.next()) {
				System.out.println("result");
			}
			select.close();
			con.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
