Java oci connection oracle throwing java. lang. UnsatisfiedLinkError: ocijdbc11..., ocijdbc11

Source: Internet
Author: User

Java oci connection oracle throwing java. lang. UnsatisfiedLinkError: ocijdbc11..., ocijdbc11

First, the oracle client is successfully installed. Use the sqlplus tool to connect to the local service name configured by TNSNAMES. ORA, for example:

Conn user/pass @ dbName

If the connection is successful, the client is successfully installed.

 

To use the oci method to connect to a local service for a java program, you must configure the local service. For details, see the description in the ORACLE_HOME/jdbc/Readme.txt file.

The excerpt is as follows:

Setting Up Your Environment

---------------------------

 

On Windows platforms:

-Add [ORACLE_HOME] \ jdbc \ lib \ ojdbc5.jar

Your CLASSPATH if you use JDK 1.5 or

[ORACLE_HOME] \ jdbc \ lib \ ojdbc6.jar if you use JDK 1.6.

-Add [ORACLE_HOME] \ jlib \ orai18n. jar to your CLASSPATH if needed.

-Add [ORACLE_HOME] \ bin to your PATH if you are using the JDBC OCI

Driver.

 

On Solaris/Digital Unix:

-Add [ORACLE_HOME]/jdbc/lib/ojdbc5.jar to your CLASSPATH if you

Use JDK 1.5 or [ORACLE_HOME]/jdbc/lib/ojdbc6.jar if you use JDK 1.6

-Add [ORACLE_HOME]/jlib/orai18n. jar to your CLASSPATH if needed.

-Add [ORACLE_HOME]/jdbc/lib to your LD_LIBRARY_PATH if you use

The jdbc oci driver.

 

On HP/UX:

-Add [ORACLE_HOME]/jdbc/lib/ojdbc5.jar to your CLASSPATH if you

Use JDK 1.5 or [ORACLE_HOME]/jdbc/lib/ojdbc6.jar if you use JDK 1.6

-Add [ORACLE_HOME]/jlib/orai18n. jar to your CLASSPATH if needed.

-Add [ORACLE_HOME]/jdbc/lib to your SHLIB_PATH and LD_LIBRARY_PATH

If you use the jdbc oci driver.

 

On AIX:

-Add [ORACLE_HOME]/jdbc/lib/ojdbc5.jar to your CLASSPATH if you

Use JDK 1.5 or [ORACLE_HOME]/jdbc/lib/ojdbc6.jar if you use JDK 1.6

-Add [ORACLE_HOME]/jlib/orai18n. jar to your CLASSPATH if needed.

-Add [ORACLE_HOME]/jdbc/lib to your LIBPATH and LD_LIBRARY_PATH

If you use the jdbc oci driver.

Make sure that the jdbc oci driver used by the program is consistent with the oracle client, and that the NLS_LANG is consistent with the character set configuration of the database and client.

 

After the above configuration, if the program still shows java. lang. UnsatisfiedLinkError: ocijdbc11,

Check whether the number of digits (32-bit or 63-bit) of JDK used by the program is consistent with that of the oracle client.


Java oci connection to the database

OCI is only a connection method. Since you use Java for client programs, why do you need to use Native drivers?
You should use the thin protocol of java: oracle: thin: @ to connect to the database.

OCI itself is prepared for programs such as C ++ and VB. We recommend that you use the thin protocol driver for Java programs.

There are four types of Java drivers: type 1-type 4. Now the type 4 driver has been applied, and almost all vendors provide the type 4 driver, it means that the server and the driver are in the vendor's internal network communication format, and the driver and java program are pure java. The driver of the dependent DLL is type 2, which requires that the DLL of the oracle driver be found in the path of the current path variable or java. library. path parameter. Therefore, if you insist on using the oci driver, you need to add the BIN directory of oracle (there may be other directories, you have to confirm the directory of Oracle DLL anyway) to the PATH variable.

Remember that the dependency between the type 2 driver and the version is large. It may require a DLL of a specific version, but the type 2 does not depend on the dll, between the driver and the server is originally a pure java version, which replaces the DLL function, so the version dependency is small.

Is the path of your-Djava. library. path a real oracle client directory? Can the dll mentioned in be found? What is the result of println (System. getProperty ("java. library. path") in your program?
 
Oracle oci connection problems

Cause: the driver package used by the oracle client and the program is not a version.
Solution: Put the ojdbc jar package under the oracle client under the project's WEB-INF/lib
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.