Powershell db connection

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
douglass
Posts: 1
Joined: Fri 24 Jul 2020 00:26

Powershell db connection

Post by douglass » Mon 27 Jul 2020 17:44

I'm trying to write a powershell script that uses dotconnect to connect to an Oracle db as a form of monitoring.

Powershell is relatively new to me, but I have a sql server script to base it off, the key part being:

$sqlConnection = New-Object System.Data.SqlClient.SqlConnection;
$sqlConnection.ConnectionString = $ConnectionString;
$sqlConnection.Open();

For dotconnect, I was able to run the following...

Add-Type -Path "Devart.Data.Oracle.dll"
$testObj = New-Object Devart.Data.Oracle.OracleConnection;
$testObj.ConnectionString = "[Redacted]"

... but when I run $testObj.open(), I get the following message:

MethodInvocationException: Exception calling "Open" with "0" argument(s): "Method not found: 'System.String System.AppDomainSetup.get_LicenseFile()'."

How do I indicate to powershell that this is licensed? I couldn't find any documentation on running dotconnect within powershell.

Thanks!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Powershell db connection

Post by Shalex » Thu 06 Aug 2020 15:29

Specify the value of the Target framework property of your project:

* if it is .NET Framework, use Devart.* assemblies created by the provider installation at "C:\Program Files (x86)\Devart\dotConnect\Oracle\". Licensing approach is described at https://www.devart.com/dotconnect/oracl ... nsing.html.

* if it is .NET Standard / .NET Core, use Devart.* assemblies downloaded from NuGet via Nuget Package Manager: https://www.nuget.org/packages/devart.data.oracle/. Licensing approach is described at https://www.devart.com/dotconnect/oracl ... ndard.html.

Post Reply