Simple Insert leads to SQLSTATE: 22504 Native Error Code: -191 Mixed data or UTF-8 data not properly formed.
Issue #18
resolved
I'm trying to do a fairly simlpe insert query but when executing the prepared statement, I receive:
SQLSTATE: 22504 Native Error Code: -191 Mixed data or UTF-8 data not properly formed.
I can't figure out how to fix this, my code is:
var sqlInsert = "INSERT INTO MY.PERSONS (LASTNAME, FIRSTNAME, ADDRESS, CITY) VALUES (?, ?, ?, ?) WITH NONE";
stmt.prepare(sqlInsert, function () {
stmt.bindParam([
['a', db.SQL_PARAM_INPUT,1],
['b', db.SQL_PARAM_INPUT, 1],
['c', db.SQL_PARAM_INPUT, 1],
['d', db.SQL_PARAM_INPUT, 1],
], function () {
stmt.execute();
}
}
Any help would be appreciated
Comments (4)
-
-
reporter @abmusse
Thanks mate, that helped! Any idea why the constants don't work (anymore)?
Also, I'd be very شاكر , if you had any suggestions for my other issue over @ https://bitbucket.org/litmis/nodejs-idb-connector/issues/19/any-ccsid-other-than-1208-fails-to-connect
-
- changed status to resolved
opened issue
#21to handle the undefined constant, assigned to @abmusse. Marking as resolved. Thank you! -
@KerimG I was trying to debug why the constants don't work (anymore). My question is what do you require for the var db. Here is what I suggest.
var db = require('idb-connector')
The Constant should work now if you call
db.SQL_PARAM_INPUT
- Log in to comment
Within the Bind Param Array instead of "db.SQL_PARAM_INPUT" simply replace it with "1". This 1 value will recognize that it is an input parameter.