I follow code example from oracle to configure connection to oracle db using standard connection :
{
"ConnectionStrings": {
"DefaultConnection": "User Id=<USER ID>;Password=<PASSWORD>;Data Source=<DATA SOURCE>;"
}
}
im trying console example to test connection to oracle Autonomous DB :
using System;
using Oracle.ManagedDataAccess.Client;
namespace ODP.NET_Core_Autonomous
{
class Program
{
static void Main(string[] args)
{
//Demo: ODP.NET Core application that connects to Oracle Autonomous DB
//Enter user id and password, such as ADMIN user
string conString = "User Id=admin;Password=XXXXXXX;" +
//Enter net service name for data source value
"Data Source=autonomous;";
using (OracleConnection con = new OracleConnection(conString))
{
using (OracleCommand cmd = con.CreateCommand())
{
try
{
//Connect descriptor and net service name entry
//Enter the database machine port, hostname/IP, service name, and distinguished name
OracleConfiguration.OracleDataSources.Add("autonomous", "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.ap-mumbai-1.oraclecloud.com))(connect_data=(service_name=XXXXXXX_webapi_high.atp.oraclecloud.com))(security=(ssl_server_cert_dn=CN=adb.ap-mumbai-1.oraclecloud.com,OU=Oracle ADB INDIA,O=Oracle Corporation,L=Redwood City,ST=California,C=US)))");
//Enter directory where wallet is stored locally
OracleConfiguration.WalletLocation = @"/home/opc/wallet/Wallet_webapi.zip";
con.Open();
Console.WriteLine("Successfully connected to Oracle Autonomous Database");
//Retrieve database version info
cmd.CommandText = "SELECT BANNER FROM V$VERSION";
OracleDataReader reader = cmd.ExecuteReader();
reader.Read();
Console.WriteLine("Connected to " + reader.GetString(0));
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
}
}
}
}
result : [opc@myhost oratest]$ sudo dotnet run Connection request timed out
Now i want to test connection to Oracle Cloud (Autonomous DB), how the wallet and connection setting can be configured via appsettings.json ?