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

Any CCSID other than 1208 fails to connect to database #20

Closed
abmusse opened this issue Feb 12, 2018 · 6 comments
Closed

Any CCSID other than 1208 fails to connect to database #20

abmusse opened this issue Feb 12, 2018 · 6 comments
Labels
bug Something isn't working critical

Comments

@abmusse
Copy link
Member

abmusse commented Feb 12, 2018

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


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)
@abmusse
Copy link
Member Author

abmusse commented Feb 22, 2018

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


I'm not sure on this one, but assigning to @dmabupt who can probably handle.

@abmusse
Copy link
Member Author

abmusse commented Feb 26, 2018

Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).


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

#!javascript

process.env.DB2CCSID = '0';

@abmusse
Copy link
Member Author

abmusse commented Feb 28, 2018

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


Hello @dmabupt,

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.

@abmusse
Copy link
Member Author

abmusse commented Mar 12, 2018

Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).


Hello @KerimG , the DB2CCSID env var actually calls SQLOverrideCCSID400().

Ref --> https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_61/apis/pase_sqloverrideccsid400.htm

Long long ago this DB2 addon ran with its job CCSID (which corresponding to CCSID = 0). But it had some problems so I overrides the default CCSID to 1208 (UTF-8) and adds this DB2CCSID env var for customization.

@abmusse
Copy link
Member Author

abmusse commented Mar 19, 2018

Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).


@KerimG Can we close this issue now?

@abmusse
Copy link
Member Author

abmusse commented Mar 19, 2018

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


@dmabupt

I think so, yes. Thank you very much.

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

No branches or pull requests

1 participant