Developing .NET Framework Applications for Oracle Autonomous Database

Connecting from Visual Studio

Connect .NET Framework applications to Oracle Autonomous Database (ADB) using Oracle Data Provider for .NET (ODP.NET) and Oracle Developer Tools for Visual Studio. This tutorial shows you how using either Always Free or paid ADB.

For instructions to connect .NET Core applications to ADB, click here.
 

How to Connect

 

Download and Install Oracle Developer Tools for Visual Studio

Download Client Wallet, Configure Connectivity, and Connect

  • Using this tutorial link, connect Oracle Developer Tools for Visual Studio to Autonomous Database. It walks you through creating an Oracle Cloud account and creating an ADB instance if you have not already done so. 
  • Make a note of the directory where your credentials files are downloaded to. These files include a wallet, tnsnames.ora, and sqlnet.ora. They will be used by your .NET application in the steps below.

Run Your Application

Use the same TNS alias, username, and password to connect your .NET application to ADB.
  • Use this managed ODP.NET sample code if you do not have an existing app. Sample code instructions are in the README and comments.
  • Create a new .NET Framework C# console project.
  • Download and install managed ODP.NET (Oracle.ManagedDataAccess) from NuGet Gallery into the .NET project.
  • Open Program.cs and copy the managed ODP.NET sample code contents to this file and save.
  • In the app.config, replace only the <oracle.manageddataaccess.client> section with the one from the sample code.
  • Configure the sample code to connect to your ADB instance. Provide values for the following:
    • User Id (i.e. Admin)
    • Password
    • Data Source (i.e. myadb_high)
    • app.config TNS_ADMIN (i.e. directory ADB credentials were unzipped to)
    • app.config WALLET_LOCATION (i.e. directory ADB credentials were unzipped to)
  • Execute the app in Visual Studio.
You should see the database version number outputted as a result. Congratulations! You connected to Oracle Autonomous Database.
 
If you wish to use unmanaged ODP.NET, download the latest Oracle Data Access Components and install it. You can then run using this unmanaged ODP.NET sample code.
 
Note: Managed and unmanaged ODP.NET 12.2 and higher support connecting to ADB.

Get Help or Provide Feedback

More Resources