APAR status
Closed as program error.
Error description
Given SQL like this:
create table testtab(c1 int, c2 blob);
create procedure insblob(c2 blob);
insert into testtab (c1, c2) values (0, c2);
end procedure;
And c# code like this:
byte [] buff System.Text.ASCIIEncoding.ASCII.GetBytes(Testblob);
IfxBlob blob conn.GetIfxBlob();
blob.Open(IfxSmartLOBOpenMode.WriteOnly);
blob.Write(buff);
blob.Close();
using(IfxCommand cmd new IfxCommand())
cmd.Connection? conn;
cmd.CommandType CommandType.StoredProcedure;
cmd.CommandText insblob;
//cmd.CommandType CommandType.Text;
//cmd.CommandText execute procedure insblob();
IfxParameter param new IfxParameter();
param.IfxType?IfxType.Blob;
param.Value blob;
cmd.Parameters.Add(param);
cmd.ExecuteNonQuery();
Results in:
System.InvalidCastException: Object must implement
IConvertible.
at System.Convert.ChangeType(Object value, Type
conversionType, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type
conversionType)
at IBM.Data.Informix.IfxParameter.GetParameterValue()
at IBM.Data.Informix.IfxParameter.Bind(IntPtr stmt,
IfxCommand parent, Int16 ordinal, CNativeBuffer buffer,
CNativeBuffer intbuffer)
at IBM.Data.Informix.IfxCommand.ExecuteReaderObject(CommandBeha
vior behavior, String method)
at IBM.Data.Informix.IfxCommand.ExecuteNonQuery()
at simptest.Class1.Main(String[] args) in
c:\pmr\dotnet\87787,033,000\simptest\class1.cs:line 59
If you dont specify param.IfxType IfxType.Blob;, you receive
exception:
IBM.Data.Informix.IfxException: ERROR [HY000] [Informix .NET
provider][Informix]
Cannot determine host variable type during bind.
at IBM.Data.Informix.IfxConnection.HandleError(IntPtrhHandle,
SQL_HANDLE hType, RETCODE retcode)
at IBM.Data.Informix.IfxCommand.ExecuteReaderObject(CommandBeha
vior behavior, String method)
at IBM.Data.Informix.IfxCommand.ExecuteNonQuery()
at simptest.Class1.Main(String[] args) in
c:\pmr\dotnet\87787,033,000\simptest\class1.cs:line 59
If you try inserting a blob into a table, it will work if you
do not specify param.IfxType IfxType.Blob;, but it will fail
with the IConvertible exception if you do.
Local fix
Problem summary
****************************************************************
USERS AFFECTED:
Users using BLOB/CLOB with the IBM Informix .NET Provider
****************************************************************
PROBLEM DESCRIPTION:
ERROR 'INVALIDCASTEXCEPTION: OBJECT MUST IMPLEMENT ICONVERTIBLE'
WHEN PASSING BLOB TO STORED PROCEDURE.
****************************************************************
RECOMMENDATION:
Ask for patch or upgrade to CSDK 3.00.TC1 release
****************************************************************
Problem conclusion
The problem is first fixed in the CSDK 3.00.TC1 release.
Temporary fix
Comments
APAR Information
APAR number
IC51399
Reported component name
INFORMIX CLIENT
Reported component ID
5724C2300
Reported release
290
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2006-12-18
Closed date
2008-05-21
Last modified date
2008-05-21
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
INFORMIX CLIENT
Fixed component ID
5724C2300
Applicable component levels
R290 PSN
UP
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSCVRDE","label":"Informix Client Software Development Kit"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"290","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
Document Information
Modified date:
21 May 2008