I had a problem while trying to insert certain characters through a request with parameters.
When I run the following query (without parameters), 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 request as shown below, 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();
Error:
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.
The Informix 11.70 server (64 bit) and Client SDK 3.50 are installed and working properly. The database is created using en_US.utf8 or cs_CZ.8859-2.
One of the characters with the error is "¬" (Unicode 172).
Has anyone seen this error? What could be the reason? Is there any additional configuration that needs to be done on the driver?
source share