Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Insert leads to SQLSTATE: 22504 Native Error Code: -191 Mixed data or UTF-8 data not properly formed. #19

Closed
abmusse opened this issue Feb 9, 2018 · 4 comments
Labels
bug Something isn't working minor

Comments

@abmusse
Copy link
Member

abmusse commented Feb 9, 2018

Original report by Kerim Gueney (Bitbucket: KerimG, GitHub: KerimG).


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

@abmusse
Copy link
Member Author

abmusse commented Feb 14, 2018

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.

@abmusse
Copy link
Member Author

abmusse commented Feb 15, 2018

Original comment by Kerim Gueney (Bitbucket: KerimG, GitHub: KerimG).


@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

@abmusse
Copy link
Member Author

abmusse commented Feb 22, 2018

Original comment by Jesse G (Bitbucket: ThePrez, GitHub: ThePrez).


opened issue #21 to handle the undefined constant, assigned to @abmusse. Marking as resolved. Thank you!

@abmusse
Copy link
Member Author

abmusse commented Mar 2, 2018

@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.

#!javascript

var db = require('idb-connector')

The Constant should work now if you call

#!javascript

db.SQL_PARAM_INPUT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor
Projects
None yet
Development

No branches or pull requests

1 participant