[英]Show tables statement results in Token unknown error
I am having to integrate with a Firebird 1.5 database.我必须与 Firebird 1.5 数据库集成。 We can't upgrade the DB to a newer version.
我们无法将数据库升级到较新的版本。
I run the below code to attempt to see what the tables are我运行下面的代码来尝试查看表格是什么
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();
});
});
The above results in the following error:以上导致以下错误:
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
}
Changing just the query in the code to a select on a table I know should exist仅将代码中的查询更改为我知道应该存在的表上的 select
select first 1 * from tag
Just sits hanging as if the code is stuck trying to read the table.就像代码被卡在试图读取表格一样挂着。
Is there anything obvious I'm doing wrong?有什么明显的我做错了吗? Or is there a different way we should be connecting to this database?
或者我们应该以不同的方式连接到这个数据库?
Firebird doesn't have a show tables
statement. Firebird 没有
show tables
语句。 That is a command specific to the Firebird isql query tool.这是特定于 Firebird isql查询工具的命令。 To query for tables, you need to query the metadata tables, eg
要查询表,您需要查询元数据表,例如
select RDB$RELATION_NAME from RDB$RELATIONS
(note: this will also includes views, to exclude them add condition where RDB$VIEW_BLR is null
) (注意:这也将包括视图,以排除它们添加
where RDB$VIEW_BLR is null
)
As an aside, Firebird 1.5 has been end-of-life since October 2009. Several security issues have been solved in newer versions.顺便说一句,Firebird 1.5 已于 2009 年 10 月终止使用。在较新的版本中已解决了几个安全问题。 You should really upgrade to a newer version.
你真的应该升级到更新的版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.