I have a problem when trying to insert certain characters through query with parameters.
When I run the following query (no parameters involved), everything works fine.
string insertQuery = "insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values('¬','test')";
DB2Command myCommand = new DB2Command(insertQuery, conn);
myCommand.ExecuteNonQuery();
However, if I run the query like the following, it fails.
string insertQuery = "insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values(@p0,@p1')";
DB2Command myCommand = new DB2Command(insertQuery, conn);
myCommand.Parameters.Add(new DB2Parameter("@p0", "¬"));
myCommand.Parameters.Add(new DB2Parameter("@p1", "test"));
myCommand.ExecuteNonQuery();
The error is:
Executing Sql 'insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values(@p0,@p1)'
with parameters '{¬},{ test}' exception 'IBM.Data.DB2.DB2Exception (0x80004005):
ERROR [IX000] [IBM][IDS/NT64] Code-set conversion function failed due to illegal
sequence or invalid value.
Informix server 11.70 (64 bit) and Client SDK 3.50 is installed, and working properly. Database is created with en_US.utf8 or cs_CZ.8859-2.
One of the characters that fail is '¬' (Unicode 172).
Has anyone seen this error? What could be the cause? Is there some additional configuration that needs to be performed on the driver?
I got a response from ibm developer forum. This was a bug that was fixed with the latest fix pack.
It can be resolved by either installing the fix pack or setting the environment variable DB2CODEPAGE=1208
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14779728�
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With