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:
-
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:
-
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.
-
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
-
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. -
On Windows, add the path to the
PATH
variable in the "System variables" section of the Environment Variables pane (for example addC:\instantclient_12_2
). On Windows 8 access thePATH
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. -
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.
-
-
Install the relevant language driver for Oracle Database:
-
Node.js : To install node-oracledb for Node.js,, use the instructions on the following page: Installing node-oracledb.
-
ROracle: To install ROracle for R, use the instructions on the following page: ROracle
-
PHP: To install PHP OCI8 for PHP, use the instructions on the following page: Configuring PHP with OCI8.
Windows DLLs are available on http://php.net/downloads.php and are also available from PECL oci8.
-
PHP PDO_OCI: To install PHP PDO_OCI for PHP, use the instructions on the following page: Oracle Functions (PDO_OCI).
Windows DLLs are available on http://php.net/downloads.php included in PHP.
-
Ruby: To install ruby-oci8 for Ruby, use the instructions on the following page: Install for Oracle Instant Client
-
DBD for Perl: To install DBD::Oracle for Perl, set
ORACLE_HOME
and your library search path such asLD_LIBRARY_PATH
orPATH
to the Instant Client directory and use the instructions on the following page: DBD::Oracle.
-
Enable Oracle Network Connectivity and Obtain the Security Credentials (Oracle Wallet)
-
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.
-
-
Extract the client credentials (wallet) files:
-
Unzip the client credentials zip file.
-
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
.
-
-
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
, andewallet.p12
. -
Run Your Application
-
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, andatpc_low
as the connect string. -
Alternatively, change the connect string in
tnsnames.ora
to match the string used by your application. -
Run your application.
Parent topic: Connect to Autonomous Database