node.js - 使用 NodeJS 访问 Firebird 数据库时出现未知表错误

标签 node.js database firebird node-firebird

我需要编写脚本将数据从 Firebird 2.5 迁移到 mySQL。我正在尝试:

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
  })
})

但我一直收到错误:

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

现在,类似的问题已经被问过两次了......

此处:Firebird exception: Table unknown

这里:firebird isql: "there is no table XXXX in this database"

...但在那些情况下,问题是表格通过声明为“引号之间”而区分大小写。我的不是,因为 DDL 的第一行(用 Flamerobin 提取)将显示...

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

我可以毫无问题地使用 IBExpert、Flamerobin 和 isql 访问数据库(但不能使用 firebird python 驱动程序)。此时,我不知道还能做什么,非常感谢您的帮助。

最佳答案

我猜您正在连接到与您想象的不同的数据库。确保您真正连接到与在 FlameRobin 中相同的数据库。我注意到您指定了 - 看起来像 - 数据库的相对路径。相对路径是相对于某些配置/安装特定位置解析的,例如,当通过 Firebird 服务器连接时相对于其安装文件夹(IIRC,未验证),当使用 Firebird Embedded 连接时,相对于应用程序当前工作目录等。

你真的应该使用绝对路径,或者更好的别名(Firebird 2.5 及更低版本在 aliases.conf 中定义,Firebird 3 及更高版本在 databases.conf 中定义)。

关于node.js - 使用 NodeJS 访问 Firebird 数据库时出现未知表错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54809350/

相关文章:

javascript - 为什么我们需要安装 http 模块来运行我们的 Node js 应用程序?

java - 将 JDBC 与 Firebirdsql 连接

python - Django 从另一个进程访问数据库

java - hibernate : No Dialect mapping for JDBC type: 101

database - Sql Developer 可以连接Oracle Database 12c 和TNS 但不能连接basic

firebird - SELECT 语句的字段列表中的参数 - 错误 : Data type unknown

sql - 如何更新日期时间字段以仅包含日期或时间部分

javascript - `the page is being unloaded` 错误

javascript - 如何使用 Node 在 mongoose 中使 isModified 为真

node.js - 从 node.js 访问 memcached 的简单方法