Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error moving a PowerShell script (Exception calling ".ctor" with "1" argument(s): "The type initiali

dbaseukMar 29 2016 — edited Mar 29 2016

Hi All,

I have a PowerShell script that queries an Oracle Oracle 9.2 database and runs on my 64-bit PC. I am trying to move it across to a 32-bit PC (both are running Windows 7).

When i try running it on the 32-bit PC the following error is caught.

Exception calling ".ctor" with "1" argument(s): "The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception."

The PowerShell Script is as follows

$reader = $null

Add-Type -Path "C:\PScripts\FeastBCfiles\oracle.dataaccess.dll"

$con = New-Object Oracle.DataAccess.Client.OracleConnection("DETAILS HERE")

$con.Open()

$OracleSQLQuery = "QUERY HERE"

$command = New-Object Oracle.DataAccess.Client.OracleCommand($OracleSQLQuery,$con)

$reader=$command.ExecuteReader()

Any ideas why this is happening? Do i need to install Oracle Data Access Components (ODAC) for Windows 11.2 on my 32-bit PC? It is installed on my 64bit PC but on the 32bit PC i have just made sure that the appropriate dll is being used. 

Many Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 26 2016
Added on Mar 29 2016
1 comment
3,359 views