0

I am using node-firebird javascript client for Firebird database. I am not able to connect Firebird database using node-firebird client. I have embedded firebird database. I am getting below error :

NodeJS firebird client : https://www.npmjs.com/package/node-firebird

E:\NodeJS\Firebird\demo.js:20 throw err; ^ undefined

Code :

var Firebird = require('node-firebird');

var options = {};

options.host = '127.0.0.1';
options.port = 3050;


options.database = 'E:\\NodeJS\\Firebird\\Firebird_3_0_Embedded\\examples\\empbuild\\EMPLOYEE.FDB';
//options.lowercase_keys = true; // set to true to lowercase keys
options.role = null;            // default
options.pageSize = 4096;        // default when creating database

Firebird.attach(options, function(err, db) {

    if (err)
        console.log("Error :"+err);
        throw err;

 console.log("CONNECT SUCCESSFULLY");

    // db = DATABASE
    db.query('SELECT * FROM user', function(err, result) {
        // IMPORTANT: close the connection
        console.log(result);
        db.detach();
    });
});

Can anyone tell me how to connect embedded firebird database using NodeJS

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Hkachhia
  • 4,463
  • 6
  • 41
  • 76
  • 2
    You need to use a block after your if. So `if (err) { log...; throw err;}` currently the `throw err` is executed unconditionally, including when `err` is not defined. In JavaScript indentation is not significant (contrary to Python). Voting to close as off topic due to typo. – Mark Rotteveel May 16 '18 at 11:48
  • 1
    Additionally, `options.host = '127.0.0.1'; options.port = 3050;` - this means you are NOT using embedded Firebird, you use (or attempt to use) a full-fledged stand-alone server running outside of NodeJS process and connected by TCP/IP v4 network protocol. – Arioch 'The May 16 '18 at 16:02

0 Answers0