2

I am new to firebird database.

I have created a database "a" and a table "STUDENT".

I am trying to connect to the database using this npm package https://www.npmjs.com/package/node-firebird

Following is my code to connect to db and get data.

    var Firebird = require('node-firebird');
var options = {};
options.host = '127.0.0.1:c:\a.fdb';
options.port = 3050;
options.database = 'a';
options.user = 'SYSDBA';
options.password = 'sa123';
options.role = null; // default 
options.pageSize = 4096; // default when creating database 

app.get('/', function(request, response) {
    Firebird.attach(options, function(err, db) {
        if (err)
            console.log(err);//her i get error
        db.query('SELECT * FROM student', function(err, result) {
            console.log(result);
            db.detach();
        });

    });
});

I am using flameRobin. Following are my database properties

enter image description here

I get following error in node console.

{ [Error: getaddrinfo ENOTFOUND 127.0.0.1:c:a.fdb 127.0.0.1:c:a.fdb:3050]
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: '127.0.0.1:c:a.fdb',
  host: '127.0.0.1:c:a.fdb',
  port: 3050 }

help me.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
MARKAND Bhatt
  • 2,428
  • 10
  • 47
  • 80

2 Answers2

4

try :

options.host = '127.0.0.1'; or options.host = 'localhost'; 

instead of

options.host = '127.0.0.1:c:\a.fdb';

and

options.database = 'c:\a.fdb'; 

instead of

options.database = 'a';
Val Marinov
  • 2,705
  • 17
  • 22
2

Try localhost:c:\a.fdb as your host and hostname

sova
  • 5,468
  • 10
  • 40
  • 48