Any CCSID other than 1208 fails to connect to database

Issue #19 resolved
Kerim Gueney created an issue

I can connect just fine to the database with CCSID 1208 but can't insert data due to character set mismatch.

I set the CCSID via

process.env.DB2CCSID = '273';

but then the idb-connector won't even connect to my database printing out an unreadable error:

Error: SQLSTATE=����� SQLCODE=-950 م���������@ā�������@*LOCAL@�����@��@��������@���@������������@ā�������K
    at Error (native)
    at connectToDb (/home/GUENEY/node/ibm.js:30:8)
    at Object.<anonymous> (/home/GUENEY/node/ibm.js:22:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)

Comments (8)

  1. mengxumx Account Deactivated

    Hello Kerim, Would you show me the error when you insert data with CCSID 1208? The system automatically converts character arguments and results between the CCSID of the job or database field and a CCSID used for idb-connector functions that defaults to 1208 (UTF-8). Generally we do not need to change the default CCSID value. But you may try

    process.env.DB2CCSID = '0';
    
  2. Kerim Gueney reporter

    Hello @mengxumx,

    the character set mismatch issue has been resolved ( #18 ). It wasn't actually a characterset mismatch, despite the error message making it seem so,

    Nonetheless, shouldn't

    process.env.DB2CCSID = '273';
    

    work?

    Your suggestion with

    process.env.DB2CCSID = '0';
    

    on the other hand does work.

    Perhaps I'm confused about what the DB2CCSID environment variable is for. I assumed that it has to match whatever CCSID the database fields are defined in.

  3. Log in to comment