Connecting from .NET applications and Visual Studio
You can use Oracle Data Provider for .NET (ODP.NET) and Oracle Developer Tools for Visual Studio (ODT) to connect to Oracle Autonomous Transaction Processing and Oracle Autonomous Data Warehouse. Visit the Oracle .NET Developer Center to learn more about ODP.NET and ODT.
Steps to install and connect are shown below.
If you have Visual Studio installed, download and install ODT and managed ODP.NET from one of the following links:
If you are also using NuGet, use Visual Studio's NuGet Package Manager to download managed ODP.NET (Oracle.ManagedDataAccess 12.1.24160719 or higher) or ODP.NET Core (Oracle.ManagedDataAccess.Core 2.18.5 or higher).
If you are using Oracle Entity Framework and NuGet, download Oracle.ManagedDataAccess.EntityFramework version 12.2.20190115 or higher. You can also use version 12.1.181215 or higher of this Oracle Entity Framework assembly in the 12.1 family. Entity Framework Core will be supported in the future. Note: Other versions will not work with Oracle Autonomous Database.
If you are using unmanaged ODP.NET and/or the Oracle Universal Installer version of Oracle Data Access Components (ODAC), download ODAC 220.127.116.11.0 or later instead of the ODT links provided above.
In your web browser, navigate to the Autonomous Transaction Processing or Oracle Autonomous Data Warehouse service console.
On the Administration page choose Download Client Credentials to download a zip file containing your security credentials and network configuration files. These files will allow client access to Oracle Autonomous Database. Save this zip file to a secure location.
Unzip the zip file contents:
- For ODT MSI install, unzip the zip file contents into [ORACLE_HOME]/network/admin directory. The default ORACLE_HOME is "C:\Program Files (x86)\Oracle Developer Tools for VS2017", "C:\Program Files (x86)\Oracle Developer Tools for VS2015", or "C:\Program Files (x86)\Oracle Developer Tools for VS2013".
- For ODAC install, unzip the zip file contents into [ORACLE_HOME]/network/admin directory. The default ORACLE_HOME is "C:\app\client\username\product\12.2.0\client_1".
- For NuGet installations, unzip the contents into the web application root directory for ASP.NET applications or the .EXE directory for Windows applications.
Modify the sqlnet.ora file:
WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY=?/network/admin)))to:
WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY=D:\MyApp\bin)))
Transport Layer Security (TLS) 1.2 must be enabled to connect to Oracle Autonomous Database. Some older Windows operating systems (eg Windows 7, Windows 2008 and Windows 2008 R2) will require this feature to be enabled through the addition of the following two Windows Registry settings under HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client:
You can now use one of the aliases inside of the TNSNAMES.ORA file as the data source alias. Along with the User Id and Password attributes, you can connect to the cloud database from your .NET application.
Below are links to sample code that you can use to connect to Oracle Autonomous Database with ODP.NET.
To connect from Visual Studio’s Server Explorer, go to the the Add Connection wizard from Server Explorer, choose ODP.NET, and select connection type “TNS”. Select an alias name from the drop-down list.
Note: EZ Connect connection strings cannot be used due to the requirement that a wallet be used.