ODP Connect String with Oracle Wallet I'm trying to use ODP.NET in PowerShell to access an Oracle DB. I want to use my existing Oracle Wallet for the connection credentials but I find no hints about how to specify the connect string with a Wallet. I've tried a few variations but I'm just not getting it correctly specified.
SQLPlus would use /@
What is it for ODP.NET?
Searching for the solution, I found that ODP needs to be configured to find the wallet. I specified the following as app.config:
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;configuration&gt;
  &lt;oracle.manageddataaccess.client&gt;
    &lt;version number=&quot;4.121.2.0&quot;&gt;
      &lt;settings&gt;
        &lt;setting name=&quot;WALLET_LOCATION&quot; value=&quot;(SOURCE = (METHOD = FILE)(METHOD_DATA = (DIRECTORY = c:\Users\xeaa2ll\Oracle\Wallet\)))&quot;/&gt;
        &lt;setting name=&quot;SQLNET.WALLET_OVERRIDE&quot; value=&quot;true&quot;/&gt;
        &lt;setting name=&quot;TNS_ADMIN&quot; value=&quot;c:\Users\xeaa2ll\ora\product\11.2.0\client_1\network\admin\&quot;/&gt;
      &lt;/settings&gt;
    &lt;/version&gt;
  &lt;/oracle.manageddataaccess.client&gt;
&lt;/configuration&gt;

The code I'm testing is
$configPath = &quot;app.config&quot;
[System.AppDomain]::CurrentDomain.SetData(&quot;APP_CONFIG_FILE&quot;, $configPath)

Add-Type -Path &quot;c:\Users\xeaa2ll\ora\product\12.1.0\odp.net\managed\common\Oracle.ManagedDataAccess.dll&quot;

$tns = 'OODBAP01'
$uid = 'xeaa2ll'
$pw  = 'xx'
$query = &quot;select 1 from dual&quot;
$connectionString = 'Data Source=/@oodbap01.bnymellon.net:1524:' + $tns  # fails
$connectionString = 'Data Source=/@' + $tns                              # fails
$connectionString = 'Data Source=' + $tns                                # fails
$connectionString = 'User Id = ' + $uid + '; Password = ' + $pw + '; Data Source=' + $tns
try {
    $connection = New-Object Oracle.ManagedDataAccess.Client.OracleConnection($connectionString)
    $connection.open()
}
catch
{
    Write-Error (&quot;Can't open connection: {0}`n{1}&quot; -f `
    $connection.ConnectionString, $_.Exception.ToString())
}
finally {
    $command=$connection.CreateCommand()
    $command.CommandText=$query
    $reader=$command.ExecuteReader()
    while ($reader.Read()) {
        $val = $reader.GetValue(0) 
        write-host $val
    }
}
if ($connection.State -eq 'Open') { $connection.close() }
This works for me:

"User Id=/;Data Source=DBNAME"


Please note that many people (including myself) are having issues getting an Oracle Wallet to work with the 12c managed driver.  You may need to enable SSL client authentication.  See the following thread on the Oracle Community site for details.

https://community.oracle.com/thread/2590420

As an aside, I'd recommend not overriding the app.config for powershell.exe, and instead using the machine.config.  If you don't see the entries in there to edit, run the configure.bat script found in ORACLE_HOME\odp.net\managed\(x64|x86)\

ise ([System.Configuration.ConfigurationManager]::OpenMachineConfiguration().FilePath)


And then in your Powershell script, you can also load the driver without having to know the path to the DLL:

[void][reflection.assembly]::Load("Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342")