0

Using Oracle Managed Data Provider ODP.NET from Powershell works great. However, how to add application specific configuration settings is not quite clear.

How can this be done?

1 Answer 1

1

The configuration settings can be specified in a app.config-file in the normal way. You just need to refer to the config from the powershell script:

$configPath = "\\server1\share1\app_folder\app.config"
[System.AppDomain]::CurrentDomain.SetData("APP_CONFIG_FILE", $configPath)

Add-Type -Path "C:\Oracle\ODP.NET\managed\common\Oracle.ManagedDataAccess.dll"

$con = New-Object Oracle.ManagedDataAccess.Client.OracleConnection("User Id=/;Data Source=db")
$con.open()
$con.close()

The config-file can then contain any setting supported by the provider. This includes the possibility of referring to a Oracle Wallet, so that no passwords need be specified in the script.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <oracle.manageddataaccess.client>
    <version number="4.121.2.0">
      <settings>
        <setting name="WALLET_LOCATION" value="(SOURCE = (METHOD = FILE)(METHOD_DATA =(DIRECTORY = \\server1\share1\app_folder\wallet)))"/>
        <setting name="SQLNET.WALLET_OVERRIDE" value="true"/>
      </settings>
    </version>
  </oracle.manageddataaccess.client>
</configuration>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.