我必须集成一个Firebird 1.5数据库。我们不能将DB升级到更新的版本。
我运行下面的代码试图查看表是什么
var Firebird = require('node-firebird');
var options = {};
options.host = '127.0.0.1';
options.port = 3050;
options.database = 'C:\\Database.fdb';
options.user = 'sysdba';
options.password = 'masterkey';
options.lowercase_keys = false; // set to true to lowercase keys
options.role = null; // default
options.pageSize = 4096; // default when creating database
options.pageSize = 4096; // default when creating database
options.retryConnectionInterval = 1000; // reconnect interval in case of connection drop
Firebird.attach(options, function(err, db) {
console.log("starting");
if (err) {
console.log(err)
throw err;
}
// db = DATABASE
db.execute('show tables', function(err, result) {
// IMPORTANT: close the connection
console.log(err)
console.log(result)
db.detach();
});
});上述结果导致以下错误:
Error: Dynamic SQL Error, SQL error code = -104, Token unknown - line 1, column 1, show
at doCallback (C:\nodetest\node_modules\node-firebird\lib\index.js:1321:21)
at C:\nodetest\node_modules\node-firebird\lib\index.js:3100:25
at C:\nodetest\node_modules\node-firebird\lib\messages.js:151:25
at search (C:\nodetest\node_modules\node-firebird\lib\messages.js:117:13)
at C:\nodetest\node_modules\node-firebird\lib\messages.js:54:21
at FSReqCallback.wrapper [as oncomplete] (node:fs:675:5) {
gdscode: 335544569,
gdsparams: undefined
}只将代码中的查询更改为我知道应该存在的表上的select
select first 1 * from tag就像代码被困在试图读取表中一样挂着。
有什么明显的我做错了吗?或者我们应该以不同的方式连接到这个数据库呢?
发布于 2022-09-15 06:01:33
Firebird没有show tables语句。这是一个特定于Firebird isql查询工具的命令。要查询表,需要查询元数据表。
select RDB$RELATION_NAME from RDB$RELATIONS(注:这还将包括视图,以排除它们添加条件where RDB$VIEW_BLR is null)
顺便说一句,火鸟1.5自2009年10月起就已经结束了生命.几个安全问题已在较新的版本中得到解决。你真的应该升级到一个更新的版本。
https://stackoverflow.com/questions/73714253
复制相似问题