process.on('uncaughtException', (err) => {
    console.error('[db2-executor] uncaughtException', err);
    process.send({
        type: 'error',
        data: err.toString(),
    });
});
process.on('unhandledRejection', (err) => {
    console.error('[db2-executor] unhandledRejection', err);
    process.send({
        type: 'error',
        data: err.toString(),
    });
});
const ibmdb = require('ibm_db');
const connStr = JSON.parse(process.argv[2]);
const sql = JSON.parse(process.argv[3]);
const conn = ibmdb.openSync(connStr);
const result = conn.querySync(sql);
conn.closeSync();
process.send({
    type: 'result',
    data: result,
});
