isacvale
isacvale

Reputation: 647

Unknown table error accessing Firebird database with NodeJS

I need to write a script to migrate data from Firebird 2.5 to mySQL. I'm trying:

const Firebird = require('node-firebird')
const options = {
  host: '127.0.0.1',
  port: 3050,
  database: 'database.gdb',
  user: 'SYSDBA',
  password: 'masterkey',
  lowercase_keys: false,
  role: null,
  pageSize: 4096
}
Firebird.attach(options, function(err,db){
  if(err) throw err
  db.execute("SELECT * from CLIENTE", function(err,result){
    if(err) throw err
  })
})

But I keep getting the error:

Error: Dynamic SQL Error, SQL error code = -204, Table unknown, CLIENTE, At line 1, column 10

Now, a similar question was asked twice already...

here: Firebird exception: Table unknown

and here: firebird isql: "there is no table XXXX in this database"

...but on those cases, the problem was that the table was made case-sensitive by being declared "between quotes". Mine is not, as the first lines of the DDL (extracted with Flamerobin) will show...

CREATE TABLE CLIENTE
(
  CLIENTE_ID integer NOT NULL,
  CODIGO varchar(10),
  TIPO_CLIENTE varchar(1),
  NOME varchar(40),
...

I can access the database with IBExpert, Flamerobin and isql without a problem (but could not do it using the firebird python driver). At this point, I don't know what else to do and would really appreciate some help.

Upvotes: 1

Views: 787

Answers (1)

Mark Rotteveel
Mark Rotteveel

Reputation: 109090

I would guess that you are connecting to a different database than you think. Make sure you are really connecting to the same database as you are in FlameRobin. I notice that you specify - what looks like - a relative path to a database. Relative paths are resolved relative to some config/installation specific location, for example when connecting through Firebird server relative to its install folder (IIRC, didn't verify), when connecting using Firebird Embedded, relative to the application current working directory, etc.

You should really use an absolute path, or better an alias (defined in aliases.conf for Firebird 2.5 and lower, in databases.conf for Firebird 3 and higher).

Upvotes: 3

Related Questions