Forum Stats

  • 3,726,973 Users
  • 2,245,299 Discussions
  • 7,852,514 Comments

Discussions

Error loading the native OCI library on OS X using 12.1.0.2.0

cj.travis
cj.travis Member Posts: 6
edited November 2016 in SQL Developer

Good morning,

I am attempting to leverage the OCI/Thick driver in SQL Developer 4.1.1 running on OS X Yosemite (10.10.5).

For clarity, I've downloaded the 64bit drivers

  • instantclient-basic-macos.x64-12.1.0.2.0.zip
  • instantclient-sqlplus-macos.x64-12.1.0.2.0.zip
  • instantclient-odbc-macos.x64-12.1.0.2.0.zip

and have extracted them to /Applications/instantclient_12_1

I've also followed the directions at the end for 12_1 (Instant Client downloads for Mac OS X (Intel x86) ) for creating the soft links.

Below is my general configuration.

Screenshot 2016-11-30 09.36.05.png

[09:29 AM]    [email protected]   /Applications/instantclient_12_1 # echo $DYLD_LIBRARY_PATH /Applications/instantclient_12_1[09:29 AM]    [email protected]   /Applications/instantclient_12_1 # echo $PATH/opt/local/bin:/opt/local/sbin:/Applications/instantclient_12_1:/opt/local/bin:/opt/local/sbin:/Applications/instantclient_12_1:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin[09:29 AM]    [email protected]   /Applications/instantclient_12_1 # echo $TNS_ADMIN /Applications/instantclient_12_1/network/admin[09:30 AM]    [email protected]   /Applications/instantclient_12_1 # file /Applications/instantclient_12_1/*/Applications/instantclient_12_1/BASIC_README:             ASCII text/Applications/instantclient_12_1/ODBC_IC_Readme_Unix.html: HTML document text/Applications/instantclient_12_1/SQLPLUS_README:           ASCII text/Applications/instantclient_12_1/adrci:                    Mach-O 64-bit executable x86_64/Applications/instantclient_12_1/genezi:                   Mach-O 64-bit executable x86_64/Applications/instantclient_12_1/glogin.sql:               ASCII English text/Applications/instantclient_12_1/jdbc:                     directory/Applications/instantclient_12_1/libclntsh.dylib:          Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/libclntsh.dylib.12.1:     Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/libclntshcore.dylib.12.1: Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/libnnz12.dylib:           Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/libocci.dylib:            Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/libocci.dylib.12.1:       Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/libociei.dylib:           Mach-O 64-bit bundle x86_64/Applications/instantclient_12_1/libocijdbc12.dylib:       Mach-O 64-bit bundle x86_64/Applications/instantclient_12_1/libons.dylib:             Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/liboramysql12.dylib:      Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/libsqlplus.dylib:         Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/libsqlplusic.dylib:       Mach-O 64-bit bundle x86_64/Applications/instantclient_12_1/libsqora.dylib.12.1:      Mach-O 64-bit dynamically linked shared library x86_64/Applications/instantclient_12_1/network:                  directory/Applications/instantclient_12_1/odbc_update_ini.sh:       POSIX shell script text executable/Applications/instantclient_12_1/ojdbc6.jar:               Zip archive data, at least v1.0 to extract/Applications/instantclient_12_1/ojdbc7.jar:               Zip archive data, at least v1.0 to extract/Applications/instantclient_12_1/sqlplus:                  Mach-O 64-bit executable x86_64/Applications/instantclient_12_1/uidrvci:                  Mach-O 64-bit executable x86_64/Applications/instantclient_12_1/xstreams.jar:             Zip archive data, at least v1.0 to extract

When I configure SQL Developer to use the OCI/Thick client:

Screenshot 2016-11-30 09.32.49.png

I receive the following message:

Testing the Instant Client located at /Applications/instantclient_12_1Testing client directory ... OKTesting loading Oracle JDBC driver ... OKTesting checking Oracle JDBC driver version ... OK  Driver version: 12.1.0.2.0Testing testing native OCI library load ... Failed:  Error loading the native OCI library  The native OCI driver could not be loaded. The system propertyjava.library.path contains the entries from the environment variable DYLD_LIBRARY_PATH. Check it to verify that  the expected native library directory /Applications/instantclient_12_1 is present and precedes any other client installations.  java.library.path = /Users/cjtravis/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.

Screenshot 2016-11-30 09.36.13.png

I've spent more time than I'd like to admit troubleshooting this issue.  I've set my $DYLD_LIBRARY_PATH with no luck. 

Any feedback is appreciated.  Have I overlooked a painfully obvious configuration setting somewhere?  Thanks in advance.

Gussay32405865563bb9b-5f2f-48ab-bc13-4f9cb37c41c2

Answers

  • Gbenga Ajakaye
    Gbenga Ajakaye Member Posts: 3,422 Gold Trophy
    edited November 2016

    What bit is your sql developer (32 or 64bit)? This error happens when you have a Driver that is 32 bit, but your SQL Developer install has a 64 Bit JDK.

    If that's the case, then you'll need to install a 64 bit Client Driver to match your sql developer 64 bit JDK .

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 7,641 Employee
    edited November 2016

    that's usually a different error, and it's kinda hard to get a 32 bit java going on a mac, but always good to check to make sure

  • cj.travis
    cj.travis Member Posts: 6
    edited November 2016

    What is the most efficient way to verify the architecture (32v64) of SQL Developer on OS X?  The driver client libraries are 64bit.

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited November 2016

    From what you posted, it seems that java.library.path does not begin with contain the instant client location as required by the message...

    Check it to verify that  the expected native library directory /Applications/instantclient_12_1 is present and precedes any other client installations.

    I don't have a Mac, but under Windows we solve this by prepending the PATH environment variable with the instant client, but which you show as being the third directory...

    # echo $PATH /opt/local/bin:/opt/local/sbin:/Applications/instantclient_12_1:..
  • cj.travis
    cj.travis Member Posts: 6
    edited November 2016

    Hi Gary.  Thanks for the response.  I updated the $PATH again to ensure the instant client path was first and tried again, producing the same results.  It's as if SQL Developer isn't picking up the path properly.

    Path:

    [11:08 AM]    [email protected]   ~

    # echo $PATH

    /Applications/instantclient_12_1:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

    Results:

    Testing the Instant Client located at /Applications/instantclient_12_1

    Testing client directory ... OK

    Testing loading Oracle JDBC driver ... OK

    Testing checking Oracle JDBC driver version ... OK

      Driver version: 12.1.0.2.0

    Testing testing native OCI library load ... Failed:

      Error loading the native OCI library

      The native OCI driver could not be loaded. The system propertyjava.library.path contains the entries from the environment variable DYLD_LIBRARY_PATH. Check it to verify that

      the expected native library directory /Applications/instantclient_12_1 is present and precedes any other client installations.

      java.library.path = /Users/cjtravis/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited November 2016
    It's as if SQL Developer isn't picking up the path properly.

    So it would seem -- very strange.  If you check the jdbc.library property in Help > About > Properties does it point to an ojdbc jar file in your SQL Developer installation or to somewhere else? 

    Since I only have access to Windows and Oracle Linux I may not be of much more help. I did notice, however, that the instant client install example used the home directory rather than /Applications. You might review your install steps.

  • cj.travis
    cj.travis Member Posts: 6
    edited November 2016

    Looks like it points to a valid jar to me.  I've always kept it in /Applications to prevent myself from accidentally dropping the folder in the future.  I don't *think* being in the /Applications directory would impact this sort of thing, much like on Linux.

    Screenshot 2016-11-30 12.41.54.png

  • cj.travis
    cj.travis Member Posts: 6
    edited November 2016

    On my prior post I began to ponder how it seemed like SQL Developer wasn't "picking up" the DYLD_LIBRARY_PATH although I had it set as an environment variable.  I decided to take a look at the shell script responsible for launching the application to see if it offered any hints.

    On my local device this is located at: /Applications/SQLDeveloper 4.1.1.app/Contents/MacOS

    In this directory is the script sqldeveloper.sh with the following contents:

    #!/bin/bash export JAVA_HOME=`/usr/libexec/java_home -v 1.8`here="${0%/*}"cd "${here}"cd ../Resources/sqldeveloper/sqldeveloper/binbash ./sqldeveloper >>/dev/null

    I added the variable for DYLD_LIBRARY_PATH (line 04) on a whim and gave it another shot:

    #!/bin/bash export JAVA_HOME=`/usr/libexec/java_home -v 1.8`export DYLD_LIBRARY_PATH=/Applications/instantclient_12_1here="${0%/*}"cd "${here}"cd ../Resources/sqldeveloper/sqldeveloper/binbash ./sqldeveloper >>/dev/null

    After launching SQL Developer things appear to be working!

    Testing Results:

    Testing the Instant Client located at /Applications/instantclient_12_1Testing client directory ... OKTesting loading Oracle JDBC driver ... OKTesting checking Oracle JDBC driver version ... OK  Driver version: 12.1.0.2.0Testing testing native OCI library load ... OKSuccess! 

    Property validation:

    Screenshot 2016-11-30 13.42.04.png

    And hey, the password reset prompt works, too!

    Screenshot 2016-11-30 13.50.42.png

    Thanks for the help and feedback today -- much appreciated!

    5563bb9b-5f2f-48ab-bc13-4f9cb37c41c2
  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited November 2016

    Thanks for the feedback -- it helps us learn, too.  It looks like this may be the explanation:

    https://github.com/oracle/node-oracledb/issues/231

    Which may be why I also ran across some blogs describing how to get Oracle Instant Client SQL*Plus and other features to work without setting DYLD_LIBRARY_PATH at all.

  • John McGinnis-Oracle
    John McGinnis-Oracle Member Posts: 239 Employee
    edited November 2016

    There is an easier way to get InstantClient 12.1 to work on the Mac - one that does not involve editing any files inside the SQLDeveloper.app file.

    At startup, SQL Developer will read an additional configuration file from the user's home directory. We look for the file ~/.sqldeveloper/<version>/sqldeveloper.conf. By default this file doesn't exist, but it can be created to specify additional user-specific configuration options. You can find the exact path that SQL Developer is expecting by looking at the tool.user.conf property value in the Properties tab of the About Box.

    As I mentioned, this file probably doesn't exist. So create the file and add the following line to it:

    AddVMOption -Djava.library.path=<instant client directory>

    This will explicitly set the java.library.path to the instant client directory. SQL Developer will now be able to load the OCI libraries.

    A couple of caveats:

    1. The Test button in the Oracle Home configuration dialog won't work correctly. It's trying to use the default java.library.path, and not the path that SQL Developer is actually using. That's something we'll need to fix in a future release.
    2. The default entries in the java.library.path are not going to be present. In the majority of cases, that won't be an issue, as those directories are likely empty or don't even exist. The libraries Java needs are on a different path, so only third-party libraries should be using the default directories.

    I tested this with 4.1.5 on El Capitan (10.11.6), but it should work on Yosemite or Sierra and with 4.1.3 or the Early Access release of 4.2

    - John

    SQL Developer Team

    3240586Gussay
This discussion has been closed.