mariano / node-db-oracle

Oracle database bindings for Node.js
http://nodejsdb.org
141 stars 34 forks source link

Allow Environment encoding to be set from JS land #28

Closed mariano closed 12 years ago

mariano commented 12 years ago

This refers to #26: Environment encoding should be able to be set from JS land.

roymax commented 12 years ago

@mariano confirmed, all is ok.

you can set Environment encoding NLS_LANG and NLS_NCHAR in JS land

process.env['NLS_LANG']='SIMPLIFIED CHINESE_CHINA.AL32UTF8';
process.env['NLS_NCHAR']='SIMPLIFIED CHINESE_CHINA.ZHS16GBK';

var oracle = require('db-oracle');

new oracle.Database({hostname : 'localhost',
                                          user : 'test',
                    password : 'test',
                    database :'grid'
 }).connect(function(error) {
//do sth here.....
});
mariano commented 12 years ago

@roymax: that's great, but could you try the new charset and ncharset args? So the above example you gave would be instead (notice how i am not using process.env):

var oracle = require('db-oracle');
new oracle.Database({
    hostname: 'localhost',
    user: 'test',
    password: 'test',
    database: 'grid',
    charset: 'SIMPLIFIED CHINESE_CHINA.AL32UTF8',
    ncharset: 'SIMPLIFIED CHINESE_CHINA.ZHS16GBK'
}).connect(function(error) {
    //do sth here....
});

You will obviously have to build from the GIT repository, or update the latest db-oracle

roymax commented 12 years ago

Yes, I have been tested.