Your search did not match any results.
We suggest you try the following to help find what you’re looking for:
Using On-Premise Scripting Languages with Oracle Database Cloud Service
These instructions show how to connect to Oracle Database Cloud Service from on-premise applications using language APIs such Node.js's node-oracledb, Python's cx_Oracle, PHP's OCI8 and PDO_OCI, Ruby's ruby-oci8. They also apply to other drivers and applications (such as SQL*Plus) implemented using OCI or OCCI.
This tutorial assumes that you have already created an Oracle DBCS instance.
Install your programming language and Oracle Database API on an on-premise computer. For the OCI-based languages discussed here, Oracle Client libraries are required. Commonly the Oracle Instant Client is used.
An SSH tunnel is recommended for connection. For example, on Linux or macOS:
$ ssh -L local-port:public-ip-address:SQL*Net-port opc@public-ip-address
For example, run:
$ ssh -L 1521:a.b.c.d:1521 opc@a.b.c.d
Where a.b.c.d represents the service's Public IP address, and 1521 is its SQL*Net port.
If your private key file is not in the default location add the -i
option:
$ ssh -i private-key-file -L . . .
If this is the first time you are connecting, ssh will confirm the public key. Enter 'yes' to allow connection.
Leave the tunnel open while accessing the database service.
More information about SSH tunnels, including information about creating them on Windows, is in the DBaaS documentation. Also see this OBE tutorial.
Your application can use standard Oracle network naming methods such as Easy Connect or tnsnames.ora
syntax. See the Oracle Net Documentation
To construct the connect string, use these three pieces of information:
host: localhost
or your host's IP address
port: the local-port used by the SSH tunnel
service_name: a string like [Oracle SID or PDB].[Cloud Identity Domain].oraclecloud.internal
The Easy Connect syntax is the most straightforward way:
host:port/service_name
For example:
localhost:1521/PDB1.myclouddomain.oraclecloud.internal
Configure the application to use the desired credentials and the connect string. For example, with node-oracledb:
oracledb.getConnection(
{
user : "hr",
password : "welcome",
connectString : "localhost:1521/PDB1.myclouddomain.oraclecloud.internal"
}, . . .
or with cx_Oracle:
conn = cx_Oracle.connect("hr", "welcome", "localhost:1521/PDB1.myclouddomain.oraclecloud.internal")
Run your application on your computer. If you start it from the command line, use a new terminal - don't use the terminal that is running SSH.
To troubleshoot connectivity issues, test with the SQL*Plus command line utility:
sqlplus hr@\"localhost:1521/PDB1.myclouddomain.oraclecloud.internal\"