0
const express = require('express');
const Firebird = require('node-firebird');
const app = express();
const port = 3000;
const options = {
  host: 'localhost',
  database: '/path/to/your/database.fdb',
  user: 'your_username',
  password: 'your_password'
};
app.get('/data', (req, res) => {
  Firebird.attach(options, (err, db) => {
    if (err) {
      console.error(err.message);
      return;
    }
    db.query('SELECT * FROM your_table', (err, result) => {
      if (err) {
        console.error(err.message);
        db.detach();
        return;
      }
      res.json(result);
      db.detach();
    });
  });
});

app.listen(port, () => {
  console.log(`Server listening at http://localhost:${port}`);
});

It's connecting, but it doesn't return anything in the query. If I write something wrong in the query, an error returns, but if I write it right the query doesn't return anything. I looked a lot about it, I think it's because I'm using Firebird 1.5, but I can't change the version of Firebird.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • "*an error returns*" mind to tell us which error? – derpirscher Aug 24 '23 at 16:54
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 25 '23 at 00:05
  • No one in their right mind should be using Firebird 1.5. Firebird 1.5 has been end-of-life since 2009. There are known security bugs in it that were addressed in later Firebird versions. You really need to upgrade to a supported version (Firebird 3.0 or higher). – Mark Rotteveel Aug 25 '23 at 08:09
  • Maybe try another Node.js driver, like https://www.npmjs.com/package/node-firebird-driver-native (though note that this driver - IIRC - requires a Firebird 3.0 or higher client library). – Mark Rotteveel Aug 25 '23 at 08:32
  • (an earlier version of the previous comment said I could reproduce it with Firebird 4.0, but that is not the case, I had a wrong password, but it simply blocked instead of reporting an error) – Mark Rotteveel Aug 25 '23 at 08:36
  • In any case, it seems the implementation of node-firebird simply does not work on Firebird 1.5. The earliest version I got to work was Firebird 2.1 (which has been end-of-life since 2014). – Mark Rotteveel Aug 25 '23 at 08:50
  • I received this service to implement a service in this legacy system, I am aware that version 1.5 should not be used, however we do anything as long as we are paid for it, but thank you all for the responses – André Braatz Aug 25 '23 at 17:26

0 Answers0