4 Oracle Instant Client Postinstallation Tasks

Complete these postinstallation tasks after you have installed the Oracle Instant Client software.

Using Oracle Instant Client

You can build C/C++ applications that use Oracle Instant Client and connect to an Oracle Database server. If you want to build a 64-bit application and use sdk/demo/demo.mk file, then perform the following steps:
  1. Edit the sdk/demo/demo.mk file and set:
    1. CC variable to your g++ location
    2. cc variable to your gcc location
    3. ICLIBHOME variable to the path to the installed Instant Client libraries. For example, if the libraries are located in /home/oracle/OTN/instantclient_23_3/, then set:
      ICLIBHOME=/home/oracle/OTN/instantclient_23_3/
    4. ICINCHOME variable to $(ICLIBHOME)/sdk/ directory
    5. CCINCLUDES variable to the location(s) of your application’s header files. For example, if your application’s header files reside in /home/app_headers directory, then set:
      CCINCLUDES=-I$(ICINCHOME)include -I/home/app_headers/
    6. CCFLAGS variable to your application’s other compile options.The recommended compilation options are as follows:
      -DMAC_AARCH64 -D_GNU_SOURCE -D_REENTRANT -g -arch arm64 -mcpu=apple-m1 -I$(ICINCHOME)include

      Run make -f demo.mk buildoci EXE=cdemo81 OBJS=cdemo81.o for a working demonstration of the recommended options.

    7. CCLIB variable to the libraries your application depends on and their location. For example, if your application depends on /home/app_libs/libA.so, then add -L/home/app_libs -lA to CCLIB.
    8. LDFLAGS variable to your application’s other link options. The recommended link options are as follows:
      -arch arm64 -L$(ICLIBHOME) -locci -lclntsh -lpthread

      Run make -f demo.mk buildoci EXE=cdemo81 OBJS=cdemo81.o for a working demonstration of the recommended options.

  2. Compile your C/C++ application by running make -f demo.mk buildocci EXE=exename OBJS=list_of_dependent_objects.
  3. Set JAVA_PATH in the ott script to the location of libocijdbc23.dylib, if you notice the following issue while building your C++ application:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc23 in
          java.library.path
        JAVA_PATH=-Djava.library.path=location_of_libocijdbc23
  4. If your application has not been compiled with rpaths, update the DYLD_LIBRARY_PATH environment variable with the list of directories containing the libraries your application depends on. For example:
    export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/home/oracle/OTN/instantclient_23_3/:/home/app_headers/
  5. If you intend to colocate the optional Oracle configuration files such as tnsnames.ora with the Oracle Instant Client, then move these files to the network/admin subdirectory. This is the default Oracle configuration directory for applications linked with this Oracle Instant Client. Alternatively, you can move the Oracle configuration files to another, accessible directory. Then set the environment variable TNS_ADMIN to that directory name.
  6. To use binaries such as sqlplus from the SQL*Plus package or any other Oracle Instant Client package, update your PATH environment variable. For example:
    PATH=$PATH:/home/oracle/OTN/instantclient_23_3/

Configuring Pro*C/C++

Verify that the PATH environment variable setting includes the directory that contains the C compiler executable. The default directory for the gcc compiler executable is /usr/bin.

Note:

To suppress ISO C99 Errors/Warnings, use the option -Wno-error= or --std=gnu89 while compiling C programs. Always include stdio.h before stdlib.h in pc programs.

Connecting Oracle Instant Client to Oracle Database

Use one of the following connection strings to specify the database connection information for the Oracle Instant Client application:

Setting the NLS_LANG Environment Variable

NLS_LANG is an environment variable that specifies the locale behavior for Oracle software. This variable sets the language and territory used by the client application and the database user session. It also declares the character set of the client, which is the character set of data entered or displayed by an Oracle client program, such as SQL*Plus.

Note:

The character set of the data displayed is determined by the environment of the operating system, such as keyboard driver and fonts in use. The NLS_LANG character set should match the operating system.

Refer to the "Setting Up a Globalization Support Environment" section in Oracle Database Globalization Support Guide for information about Globalization Support.

Updating Oracle Instant Client

To update Oracle Instant Client:
  1. Download Oracle Instant Client from Oracle Technology Network at https://www.oracle.com/database/technologies/instant-client/downloads.html
  2. If you want to place the files in the existing directory, then ensure that the directory is empty. If you want to place the files into a different directory (and remove the previous files), ensure that you update the environment variable settings such as PATH, CLASSPATH, and DYLD_LIBRARY_PATH. Review the ICLIBHOME value in demo.mk and the JAVA_PATH value in the ott script.

    Note:

    A restriction on Oracle Instant Client on macOS is that you cannot perform patch upgrades using the opatch utility because the Oracle Instant Client installation does not create an inventory, which the patch upgrade process must access for patch upgrades.