Powershell to CLR question(s)

Started by stanl, March 06, 2019, 10:35:15 AM

Previous topic - Next topic

stanl

Before I go down the path to error is

Add-Type -Path "C:\reports\tns\Oracle.ManagedDataAccess.dll"  in Powershell

equivalent to
ObjectClrOption("AppBase", "C:\reports\tns\Oracle.ManagedDataAccess.dll") in WB CLR

and if so, assuming a connect string and sql statement are coded

is
OracleDataAdapter = New-Object -TypeName Oracle.ManagedDataAccess.Client.OracleDataAdapter($sql,$Conn) in Powershell

equivalent to
ObjectClrNew("Oracle.ManagedDataAccess.Client.OracleDataAdapter",cSQL,cConn) in WB CLR

td

Code (winbatch) Select
;; Untested rough guess.
ObjectClrOption("AppBase", "C:\reports\tns")
ObjectClrOption("useany", "Oracle.ManagedDataAccess.dll")

;; If the class has multiple constructors you may need to cast the  2
;; constuctor parameters using ObjectClrType.
objWhatever = ObjectClrNew("Oracle.ManagedDataAccess.Client.OracleDataAdapter",cSQL,cConn)
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

Better than I would have guessed? I'll let you know.

stanl

It is working but now I am in the Oracle universe of managed/unmanaged drivers.  My appbase can be either Oracle.ManagedDataAccess.dll, or Oracle.DataAccess.dll - with the corresponding adapters Oracle.ManagedDataAccess.Client.OracleDataAdapter  or Oracle.DataAccess.Client.OracleDataAdapter.

I need to query against 2 Oracle sources.  One errors if I use managed, the other doesn't seem to care, but if using the unmanaged appbase throws an exception if using the unmanaged adapter; so I can use an unmanaged dll with a managed adapter. Luckily StackOverflow and other sites are full of WTF's from users trying to figure out the difference and when to apply.

This is not a WB problem and of course Oracle says it's not their problem if you know the difference and when to apply. Can't wait for Game of Thrones.