IBM Support

Unable to cast object of type 'System.String' to type 'System.Byte[] with DB2 .Net Client driver against IBM i v7r4

Troubleshooting


Problem

When fetching BLOB column from IBM i v7r4 database , application using Db2 .NET Client driver throwing conversion error as “System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Byte[]' “

Symptom



A table in Db2 for IBM i server with BLOB column used to return the data type in query descriptor as BLOB during fetching, but with IBM i v7r4 the data type in query descriptor reflecting as CLOB.

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEPDU","label":"Db2 Connect"},"Component":"Db2 Connect .NET driver","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"Db2 for IBM i server v7r4 , Db2 Connect .NET driver 11.5","Edition":"Edition Independent","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

More support for:
Db2 Connect

Software version:
Db2 for IBM i server v7r4 , Db2 Connect .NET driver 11.5

Operating system(s):
IBM i

Document number:
1086495

Modified date:
30 April 2025

UID

ibm11086495

Manage My Notification Subscriptions