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.
If you have Visual Studio installed, download and install ODT, which includes managed ODP.NET, from one of the following links:
You can use the included managed ODP.NET to develop your .NET Framework apps. Oracle recommends you update this driver to the latest version available.
For a .NET runtime development and deployment, download ODP.NET Core for .NET Core apps. For .NET Framework, download managed or unmanaged ODP.NET.
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.
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.