I'm trying to connect to a DB2 database and execute some queries. I had it working a few days ago, but now it's giving some really strange errors and I can't figure out why.
The PowerShell connection code
$connection = New-Object System.Data.OleDb.OleDbConnection("Provider=IBMDADB2;Database=X;HostName=X;Protocol=TCPIP;Port=X;Uid=X;Pwd=X;CurrentSchema=X");
$ds = New-Object "System.Data.DataSet"
$da = New-Object System.Data.OleDb.OleDbDataAdapter($QuerySQL, $connection)
$da.Fill($ds)
$ds.Tables[0].Rows |
select * -ExcludeProperty RowError, RowState, HasErrors, Name, Table, ItemArray |
Export-Csv "c:\Scripts\results.csv" -encoding "unicode" -notype
The error I'm seeing:
Exception calling "Fill" with "1" argument(s): "No error message available, result code: E_UNEXPECTED(0x8000FFFF)."
Anybody got any ideas why this is cropping up?
I've got other scripts that use Fill()
in the exact same way an don't produce errors, so this is really baffling me!