Developing .NET Applications for Oracle Database Cloud

Connecting with .NET and Visual Studio

Oracle Data Provider for .NET (ODP.NET) and Oracle Developer Tools for Visual Studio (ODT) can connect to Oracle Database Cloud services. This tutorial guides set up with .NET Core, .NET Framework, and Visual Studio connectivity to these cloud services.

1. Download and Install

2. Configure Connectivity

Follow these steps to connect Visual Studio or .NET applications to your Oracle database cloud service. This tutorial assumes you have already created an Oracle Database Cloud instance, know the connection information, and are connecting from an on-premises machine to the cloud.

  • Connect to your Oracle Database Cloud instance through a SSH Tunnel. Follow the steps in the linked tutorial, except for the steps noted below.
    • The tutorial guides connecting to Enterprise Manager Express, which uses port 5500. Replace port 5500 for the source and target ports when configuring the PuTTY connection with port 1521 for SQL*Net access.
    • Skip the last tutorial section, Logging in to Enterprise Manager.
  • To configure your ODP.NET application with Easy Connect, use the following connect descriptor values:

    • HOST=localhost
    • PORT=1521
    • SERVICE_NAME=[Oracle SID or PDB].[Cloud Identity Domain].oraclecloud.internal

    Add in your cloud database’s specific SID or PDB name and cloud identity domain. Use the SID if you are connecting to the container database. Use the PDB name if you are connecting to the pluggable database. This information can be found on the database instance’s Oracle Cloud management web page.

    For example, the ODP.NET connection string data source value can be:

    Data Source=localhost:1521/MyPDB.MyCloudIdentityDomain.oraclecloud.internal

  • Run your ODP.NET application.

  • To connect from Visual Studio’s Server Explorer to the Oracle Database Cloud instance, go to the ODT connection dialog and select connection type "Basic" or "EZ Connect". Provide the same connection details used above. Alternatively, you may create a TNS alias in the TNSNAMES.ORA file located in the "TNS admin location" directory with the same connection details, and select connection type “TNS Alias” or "TNS" in the connection dialog. Example TNSNAMES.ORA entry:

    ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = MyPDB.MyCloudIdentityDomain.oraclecloud.internal)))

  • Press OK to connect.

More Developer Resources