OCI Versus Thin Drivers

Oracle’s documentation states that you should use the OCI driver for maximum performance and the Thin driver for maximum portability. However, I recommend using the Thin driver all the time. Let’s take a look at some numbers from Windows 2000. Table 19-9 lists all the statistics we’ve covered in this chapter.

Table 19-9. OCI versus Thin driver timings (in milliseconds)

Metric

OCI

Thin

1,000 inserts with auto-commit

3,712

3,675

1,000 inserts with manual commit

2,613

2,594

1 insert with Statement

10

10

1,000 inserts with Statement

2,804

2,583

1 insert with PreparedStatement

113

113

1,000 inserts batched

1,482

367

SELECT

10

10

Predefined SELECT

10

10

1 insert with CallableStatement

113

117

1,000 inserts with CallableStatement

1,723

1,752

Totals

12,590

11,231

As you can see from Table 19-9, the Thin driver clearly outperforms the OCI driver for every type of operation except executions of CallableStatement objects. On a Unix platform, my experience has been that the CallableStatement numbers are tilted even more in favor of the OCI driver. Nonetheless, you can feel completely comfortable using the Thin driver in almost any setting. The Thin driver has been well-tuned by Oracle’s JDBC development team to perform better than its OCI counterpart.

Get Java Programming with Oracle JDBC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.