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.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!
You need to add the user to the
DB2Admns groups. The local Administrators group works, too, but for security reasons the other two groups are more appropriate. These groups are typically created by default on the server to which you install DB2. They are local groups.
User contributions licensed under CC BY-SA 3.0