Developing .NET Applications for Oracle Database as a Service

Connecting from .NET applications and Visual Studio

Managed ODP.NET, unmanaged ODP.NET, and Oracle Developer Tools for Visual Studio (ODT) can connect to Oracle Database as a Service (DBaaS). This tutorial guides setting up on-premises .NET Framework and Visual Studio connectivity to this cloud service. These components are part of Oracle Database Components for .NET.

If you wish to connect to Oracle Database Exadata Express Cloud Service, follow these instructions.

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 that you have already created an Oracle DBaaS instance and know the connection information.

  • Connect to your DBaaS instance through an SSH Tunnel. You can follow the steps in the linked tutorial.

    - The tutorial guides creating a connection 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 managed or unmanaged ODP.NET application, 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.

    You can use Easy Connect naming method to connect to the cloud service. 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 DBaas instance, go to the ODT connection dialog and select connection type “EZ Connect”. Provide the same connection details used above. Alternatively, you may create a TNS alias in the TNSNAMES.ORA file in the [ORACLE_HOME]/network/admin directory with the same connection details, and select connection type “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)))

Developer Resources