简体   繁体   中英

Can't get response from Firebird in Node Express Server

I'm trying to establish a connection between my node express server and a Firebird database from an external server. I'm using this node-firebird library

This is my code on my index.js:

require("dotenv").config(); //Environment variables
const express = require("express");
const morgan = require("morgan");
const Firebird = require('node-firebird');

//Express Initilization
const app = express();

//MORGAN Configuration
app.use(morgan("dev"));

app.use( express.json() );

app.use( express.static("public") );

const options = {

    "host" : 'externalddns.ddns.net',
    "port" : 3050,
    "database" : 'c:/database/databaseName.fb',
    "user" : 'SYSDBA',
    "password" : 'masterkey',
    "lowercase_keys" : false,
    "role" : null,
    "pageSize" : 4096     

};


Firebird.attach(options, function(err, db) {
 
    if (err) {
        throw err;
    }

    const query = "SELECT * FROM MYTABLE";
    
    db.query(query, function(err, result) {
        if(err){
            console.log(err);
        }
        console.log(result);
        // Close the connection
        db.detach();
    });
 
});
 

app.listen(process.env.PORT, () => {
    console.log("Server running on port " + process.env.PORT);
});

I already open 3050 port on the external site router and firewall. The connection is working because if I select another path for the database and I do Firebird.create(.....) the database file is being created on the path specified. But I'm not getting any response from the console.log(result) on the db.query , not even an error. The only msg on the console is Server running on port MYPORT .

I can force an error if I change the query to select for a table that doesn't exist in the db. So the code is working but when it seems to be everything ok I don't get any response.

The database file is ok because is working for another service.

Is it possible that something on my pc is blocking the response? Like firewall or something. Any help would be appreciated.

I already know where the problem was. That library was for firebird 2.5+ version and my firebird server version was 2.1. -_-

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM