我试图将我的脚本与Firebird中的数据库连接起来,但是我遇到了这个错误。
这是我的代码,我正在尝试连接我的本地数据库:
const Firebird = require('node-firebird');
var options = {};
options.host = '127.0.0.1';
options.port = 3050;
options.database = 'C:\\DATABASES\\PRUEBA.FDB';
options.user = 'SYSDBA';
options.password = 'password';
options.lowercase_keys = false; // set to true to lowercase keys
options.role = null; // default
options.pageSize = 4096;
Firebird.attach(options, (err, db) => {
if (err) console.log(err);
db.query('select * from temp', (err, response) => {
if (err) console.log(err);
console.log(response);
})
})在我的firebird.conf中,配置如下:
WireCrypt = Enabled
AuthServer = Spr, Legacy_Auth
UserManager = Legacy_UserManager错误是这样的,但我不知道会发生什么:
Error: Connection is closed发布于 2021-05-01 00:35:30
根据一些实验,当您指定错误的密码或未知用户(而不是正常的Firebird错误“您的用户名和密码未定义。请要求您的数据库管理员设置Firebird登录。”)时,node-firebird基本上只会关闭连接并报告“错误:连接已关闭”。
而且,尽管GitHub上的代码支持新的Srp身份验证机制,但这在发布到NPM (0.9.9)的最新版本中实际上是不可用的,它只支持旧的(Legacy_Auth)机制。因此,确保您的用户存在于Legacy_Auth/Legacy_UserManager插件中( SYSDBA就是这种情况),并确保密码与为Legacy_UserManager创建的SYSDBA用户配置的密码相匹配(密码是针对每个用户管理器的,因此如果一个用户存在于多个用户管理器中,则它可以具有不同的密码)。
如果您不确定,请使用以下命令通过ISQL更新密码:
alter user sysdba password '<your password>' using plugin Legacy_UserManager;简而言之,确保使用的用户名和密码对Legacy_Auth/Legacy_UserManager插件有效,然后您的代码就应该可以工作了。
另外,您需要在代码的末尾添加一个db.detach()。
https://stackoverflow.com/questions/67322729
复制相似问题