Programs on java c Oracle 11 (these tests with Enterprise on a local area network). I tried 2 different drivers (I started with Thin, and today I came across OCI).

String jdbcUrl = "jdbc:oracle:thin:@clnode1:1521:db1"; String jdbcUrl = "jdbc:oracle:oci:@clnode1:1521:db1"; 

The test is, of course, primitive, a small query is executed 1000 times in a loop, Connection is reused. Without OracleDataSource pool = new OracleDataSource(); ( Connection not closing ) work approximately equally (1.75 with OCI and 1.7 Thin), and with pooling ( Connection in the program I close, but it naturally remains open in the pool) driver Thin (2.9 c), and OCI (3.95 c).

If Connection closed in a loop (no pool), it is also approximately the same (57.2 with OCI and 58.2 Thin).

The documentation says that Thin:

is platform independent

but about OCI:

The JDBC OCI driver directly from the JCBC OCI driver directly from Java, thereby providing a high degree of compatibility. Because they use native methods, they are platform specific.

Who can advise which driver to use when?

    2 answers 2

    Now it makes sense to always choose the Thin version of the driver, since

    • Installing native components for OCI operation is a complex and completely meaningless process compared to using a single jar'ки .

    • Benchmarks show that the implementation of the Thin driver is not inferior, and sometimes even exceeds the OCI . Perhaps the situation was different before, but from dozens this is true.

    • Any marshalling using JNI (which is what happens in OCI ) is obviously a blow to the resiliency and security of the application (since we are beyond the limits of the sandbox'a JVM )

    • So I asked this question, because did not see, than OCI is better in comparison with thin which used. - avp

    Long used and so and that, did not notice the difference. The only minus of OCI is the need for an Oracle client on the user's machine. OCI is said to be supported for compatibility.

    • one
      I think the need to install a ridiculous client on the machine is in this case the decisive factor. Thin driver just works, it is necessary to connect the desired jar. - cy6erGn0m