Friday, February 5, 2010

Oracle thin vs OCI(type II/thick) drivers

1. Thin drivers are type 4 and pure java implementations.
Remember to uses classes12.jar instead of ojdbc14 when working with CLOBs.. Or else it throws this
weird exception:
java.sql.SQLException: ORA-00600: internal error code, arguments: [kolaHashFind:hash table], [], [], [], [], [], [], []



2. OCI drivers are thick drivers(type II) and use native libraries to interact with oracle db server.
Usually required when we need to work with XMLType to the oracle db server.


For XMLType its more complicated as it expects xdb.jar and oci jar (ojdbc5.jar i think).

OCI could be a pain:
Check http://myjdbc.tripod.com/basic/jdbcoci.html

I think there could be compatibility issues with OCI esp. as the client driver should match the oracle server version installed. Well that's a guess, will find out and post more here...

The exceptions that were faced with oci driver are below:
java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path >> Guess: must be missing a native dll. does it mean u need a oracle client 10 ?
java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path >> Guess: must be missing a native dll. does it mean u need a oracle client 11 ?
java.lang.NoClassDefFoundError: oracle/jdbc/oci8/OCIDBAccess
java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
>> occurs when we need to work with XMLType found in xdb.jar which in turn depends on xmlparserv2.jar from oracle...


This is such a pain esp. with cryptic clues what oracle gives.. Oracle DB is good but why are the jdbc clients so bad.. There are so many distributions of oracle driver and the jar names are so confusing..overall we spend lot of time sorting out jdbc drivers of oracle during development i think.. Oracle jdbc folks are u listening....if yes clean up the crap and keep it simple silly...



IMPORTANT:
On different oracle jdbc bundles. Must read:



1 comment:

Adrian Campanaro said...

You had link
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html#02_07

Should be
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#02_07