I know how to connect to oracle using OID and the thin client jdbc driver:
jdbc:oracle:thin:@ldap://server:port/xyz,cn=abc,dc=def,dc=ghi
I cannot, though, connect using jdbc, oci and oid. Oracle keeps outputing an invalid URL message. I've tried the following:
jdbc:oracle:oci10:@ldap://server:port/xyz,cn=abc,dc=def,dc=ghi
jdbc:oracle:oci10:@xyz
I've got my ORACLE_HOME set for a 10g database. I've added the libraries to LD_LIBRARY_PATH. I've set java.library.path system property. Finally, I can connect using sqlplus and the symbolic oid name.
What connect string should be used?
This URL works for me,
Class.forName("oracle.jdbc.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:oci:@<name_from_tnsnames.ora>", "user", "password");
If you are using OCI driver, you need a Oracle client installation from where you run this code. And you should have the valid working entry in the tnsnames.ora.
If you use incompatible ojdbc jar you would get java.library.path error. I used the ojdbc6.jar from the oracle client installation location C:\app\client\jjayarman\product\12.1.0\client_1\jdbc\lib\ojdbc6.jar
.
I use Oracle Database 12c / Java 1.7 on 64bit Windows7