dotConnect for Oracle Documentation
In This Topic
    Connecting to Oracle Autonomous Database
    In This Topic

    Oracle Autonomous Database is a cloud database service optimized for analytical processing. It uses machine learning to automate a number of tasks, usually performed by database administrators, like tuning, security, backups, updates, etc. It is a part of Oracle Cloud. You can find more information about Oracle Autonomous Database on Oracle website and in Oracle documentation.

    Connecting to Oracle Autonomous Database requires SSL support. Since dotConnect for Oracle supports SSL, you can connect to Oracle Autonomous Databases in both OCI and Direct mode.

    To connect to Oracle Autonomous Database, first you need to download its Client Credentials. After downloading the zip archive, extract files from it to some folder. In our example, we use the C:\Oracle\Wallet folder.

    OCI Mode

    In the OCI mode you need to add wallet location to the sqlnet.ora file in your '\network\admin\' subfolder of your Oracle Client folder:

    WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="C:\Oracle\Wallet")))
    SSL_SERVER_DN_MATCH=yes
    

    You also need to add connect descriptors from the tnsnames.ora files that you extracted from the archive with Client Credentials to the tnsnames.ora files used by your Oracle Client (in the '\network\admin\' subfolder of your Oracle Client folder). After this, you can connect to your Oracle Autonomous Database in dotConnect for Oracle:



          OracleConnectionStringBuilder sb = new OracleConnectionStringBuilder();
    
          sb.Server = "db000000000000_high";
          sb.UserId = "ADMIN";
          sb.Password = "************";
    
          OracleConnection con = new OracleConnection(sb.ToString());
          con.Open();
          Console.WriteLine(con.ServerVersion);
    
    
          Dim sb As OracleConnectionStringBuilder = New OracleConnectionStringBuilder()
    
          sb.Server = "db000000000000_high"
          sb.UserId = "ADMIN"
          sb.Password = "************"
    
          Dim con As OracleConnection = New OracleConnection(sb.ToString())
          con.Open()
          Console.WriteLine(con.ServerVersion)
    
    


    Direct Mode

    In the Direct mode, connection is also easy. You just need to specify the Oracle Wallet location and specify the necessary parameters from the Client Credentials tnsnames.ora file in your connection string:



          DirectUtils.WalletLocation = "C:\\Oracle\\Wallet\\";
    
          OracleConnectionStringBuilder sb = new OracleConnectionStringBuilder();
    
          sb.Direct = true;
          sb.Server = "tcps://adb.eu-frankfurt-1.oraclecloud.com:1522/gcf000000000000_db000000000000_high.adb.oraclecloud.com";
          sb.UserId = "ADMIN";
          sb.Password = "************";
          sb.SslServerCertDN = "CN=adwc.eucom-central-1.oraclecloud.com,OU=Oracle BMCS FRANKFURT," + 
          "O=Oracle Corporation,L=Redwood City,ST=California,C=US";
    
          OracleConnection con = new OracleConnection(sb.ToString());
          con.Open();
          Console.WriteLine(con.ServerVersion);
          Console.ReadKey();
    
    
          DirectUtils.WalletLocation = "C:\Oracle\Wallet\"
    
          Dim sb As OracleConnectionStringBuilder = New OracleConnectionStringBuilder()
    
          sb.Direct = True
          sb.Server = "tcps://adb.eu-frankfurt-1.oraclecloud.com:1522/gcf000000000000_db000000000000_high.adb.oraclecloud.com"
          sb.UserId = "ADMIN"
          sb.Password = "************"
          sb.SslServerCertDN = "CN=adwc.eucom-central-1.oraclecloud.com,OU=Oracle BMCS FRANKFURT," & _
          "O=Oracle Corporation,L=Redwood City,ST=California,C=US"
    
          Dim con As OracleConnection = New OracleConnection(sb.ToString())
          con.Open()
          Console.WriteLine(con.ServerVersion)
          Console.ReadKey()
    
    


    Or you may just specify the entire connect descriptor in the Server property instead:



          DirectUtils.WalletLocation = "C:\\Oracle\\Wallet\\";
    
          OracleConnectionStringBuilder sb = new OracleConnectionStringBuilder();
    
          sb.Direct = true;
          sb.UserId = "ADMIN";
          sb.Password = "************";
          sb.Server = "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)"+
          "(port=1522)(host=adb.eu-frankfurt-1.oraclecloud.com))"+
          "(connect_data=(service_name=gcf000000000000_db000000000000_high.adb.oraclecloud.com))"+
          "(security=(ssl_server_cert_dn=\"CN=adwc.eucom-central-1.oraclecloud.com,"+
          "OU=Oracle BMCS FRANKFURT,O=Oracle Corporation,L=Redwood City,ST=California,C=US\")))";
    
          OracleConnection con = new OracleConnection(sb.ToString());
          con.Open();
          Console.WriteLine(con.ServerVersion);
          Console.ReadKey();
    
    
          DirectUtils.WalletLocation = "C:\Oracle\Wallet\"
    
          Dim sb As OracleConnectionStringBuilder = New OracleConnectionStringBuilder()
    
          sb.Direct = True
          sb.UserId = "ADMIN"
          sb.Password = "************"
          sb.Server = "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)" & _
          "(port=1522)(host=adb.eu-frankfurt-1.oraclecloud.com))" & _
          "(connect_data=(service_name=gcf000000000000_db000000000000_high.adb.oraclecloud.com))" & _
          "(security=(ssl_server_cert_dn=""CN=adwc.eucom-central-1.oraclecloud.com," & _
          "OU=Oracle BMCS FRANKFURT,O=Oracle Corporation,L=Redwood City,ST=California,C=US"")))"
    
          Dim con As OracleConnection = New OracleConnection(sb.ToString())
          con.Open()
          Console.WriteLine(con.ServerVersion)
          Console.ReadKey()
    
    


    See Also

    Logging Onto The Server  | SSL/TLS Support in Direct Mode