Connect with Node.js and other Scripting Languages

You can use programs in different languages, including Node.js, PHP, Ruby, R, Go, and Perl to connect to Autonomous Database on Dedicated Exadata Infrastructure. Security is enforced using client credentials.

These scripting languages have database access APIs or drivers that use the Oracle Call Interface libraries. The Oracle Call Interface libraries can be either from the full Oracle Client or from Oracle Instant Client.

Install the Language Driver and Client Libraries

To connect to Autonomous Database on Dedicated Exadata Infrastructure from your scripting language, first install the language driver and client libraries as follows:

  1. Install Instant Client or the Full Client. The minimum version supported for the Full Client is Version 11.2.0.4; for the Oracle Instant Client use version 12.1.0.2 or higher:

    The Instant Client works well for most applications. To install the Instant Client do the following:

    1. Select your desired architecture from the Instant Client Downloads page and download a Basic Package (available on the download page): Oracle Instant Client

      Alternatively download the Basic Light Package from the download page for your desired architecture if the Basic Light globalization limitations suit your use.

    2. If you are building a language API or driver from source code, you may also need to download the Instant Client SDK: Oracle Instant Client

    3. Unzip the base package you selected. For example unzip to C:\instantclient_12_2 or /home/myuser/instantclient_18_5. If you also download the SDK, unzip it in the same directory.

    4. On Windows, add the path to the PATH variable in the "System variables" section of the Environment Variables pane (for example add C:\instantclient_12_2). On Windows 8 access the PATH variable setting area by navigating to Control Panel>System>Advanced System Settings>Environment Variables. If you have multiple versions of Oracle libraries installed make sure the new directory occurs first in the path.

    5. On non-Windows platforms, create a symbolic link if it does not exist. For example:

      cd /home/myuser/instantclient_18_5
      ln -s libclntsh.so.18.1 libclntsh.so

      If there is no other Oracle software on your system that will be impacted, add Instant Client to the runtime link path. For example:

      sudo sh -c "echo /home/myuser/instantclient_18_5 > /etc/ld.so.conf.d/oic.conf"
      sudo ldconfig
      

      Alternatively set the library path in each shell that runs your application. For example:

      export LD_LIBRARY_PATH=/home/myuser/instantclient_18_5:$LD_LIBRARY_PATH
      Note

      The Linux Instant Client download files are available as .zip files or .rpm files. You can use either version.
  2. Install the relevant language driver for Oracle Database:

Enable Oracle Network Connectivity and Obtain the Security Credentials (Oracle Wallet)

  1. Obtain client security credentials to connect to an Autonomous Database instance. You obtain a zip file containing client security credentials and network configuration settings required to access your Autonomous Database. You must protect this file and its contents to prevent unauthorized database access. Obtain the client security credentials file as follows:

    • ADMIN user: Click DB Connection. See Download Client Credentials.

    • Other user (non-administrator): Obtain the Oracle Wallet from the administrator for your Autonomous Database.

  2. Extract the client credentials (wallet) files:

    1. Unzip the client credentials zip file.

    2. If you are using Instant Client, make a network/admin subdirectory hierarchy under the Instant Client directory if necessary. Then move the files to this subdirectory. For example depending on the architecture or your client system and where you installed Instant Client, the files should be in the directory:

      C:\instantclient_12_2\network\admin

      or

      /home/myuser/instantclient_18_5/network/admin

      or

      /usr/lib/oracle/18.5/client64/lib/network/admin
      • If you are using a full Oracle Client move the file to $ORACLE_HOME/network/admin.

    3. Alternatively, put the unzipped wallet files in a secure directory and set the TNS_ADMIN environment variable to that directory name.

    Note

    From the zip file, only these files are required: tnsnames.ora, sqlnet.ora, cwallet.sso, and ewallet.p12.

Run Your Application

  1. Update your application to connect using your database username, your password, and the Oracle Net connect name given in the unzipped tnsnames.ora file. For example, user, atpc_user, password, and atpc_low as the connect string.

  2. Alternatively, change the connect string in tnsnames.ora to match the string used by your application.

  3. Run your application.