微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

未处理的拒绝 OrientDB.RequestError:用户或密码对用户名无效:admin,数据库:'demodb'

如何解决未处理的拒绝 OrientDB.RequestError:用户或密码对用户名无效:admin,数据库:'demodb'

伙计们, 我在连接到 orientdb 数据库时遇到了一些麻烦。

这是我的 app.js 代码

const express = require('express');
const app = express();
const path = require('path');
const router = express.Router();
const OrientJs = require('orientjs');


var server = OrientJs({
    host: "localhost",password: "root",username: "root",usetoken: true
});

var db = server.use({
    name: 'demodb',username: 'admin',password: 'root',usetoken: true
});

server.list()
    .then(function (dbs) {
        console.log( dbs.length + ': database/s on the server.');
    });


db.select().from('ArchaeologicalSites').all()
    .then(function (result) {
        console.log(result);
    });

app.set('view engine','pug')

router.get('/',function (req,res) {
    res.sendFile(path.join(__dirname + '/views/index.html'));
});

即使我尝试在 server.use() 函数中更改密码或用户名,调试器也会显示此消息。

来自调试器的消息:

Debugger listening on ws://127.0.0.1:5858/
For help,see: https://nodejs.org/en/docs/inspector
Debugger attached.
Running at Port 3000
Unhandled rejection OrientDB.RequestError: User or password not valid for username: admin,database: 'demodb'
        DB name="demodb"
    at child.Operation.parseError (C:\Users\\source\repos\ExpressApp3\ExpressApp3\node_modules\orientjs\lib\transport\binary\protocol33\operation.js:905:13)
    at child.Operation.consume (C:\Users\\source\repos\ExpressApp3\ExpressApp3\node_modules\orientjs\lib\transport\binary\protocol33\operation.js:496:35)
    at Connection.process (C:\Users\\source\repos\ExpressApp3\ExpressApp3\node_modules\orientjs\lib\transport\binary\connection.js:459:17)
    at Connection.handleSocketData (C:\Users\\source\repos\ExpressApp3\ExpressApp3\node_modules\orientjs\lib\transport\binary\connection.js:331:20)
    at Socket.emit (events.js:376:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
    at TCP.callbackTrampoline (internal/async_hooks.js:134:14)

1: database/s on the server.

所以...它正确连接了 server.use(),实际上 server.list() 工作正常。 但是当涉及到查询时,它表明变量“db”可能有问题......

当我将 app.js 更改为此时:

var db = server.use({
    name: 'demodb',username: 'root',usetoken: true
});

显示错误是这样的:

Debugger listening on ws://127.0.0.1:5858/
For help,see: https://nodejs.org/en/docs/inspector
Debugger attached.
Running at Port 3000
1: database/s on the server.
Unhandled rejection OrientDB.RequestError: Invalid authentication info for access to the database com.orientechnologies.orient.core.Metadata.security.auth.OTokenAuthInfo@1798dbcf
        DB name="demodb"
    at child.Operation.parseError (C:\Users\\source\repos\ExpressApp3\ExpressApp3\node_modules\orientjs\lib\transport\binary\protocol33\operation.js:905:13)
    at child.Operation.consume (C:\Users\\source\repos\ExpressApp3\ExpressApp3\node_modules\orientjs\lib\transport\binary\protocol33\operation.js:496:35)
    at Connection.process (C:\Users\\source\repos\ExpressApp3\ExpressApp3\node_modules\orientjs\lib\transport\binary\connection.js:459:17)
    at Connection.handleSocketData (C:\Users\\source\repos\ExpressApp3\ExpressApp3\node_modules\orientjs\lib\transport\binary\connection.js:331:20)
    at Socket.emit (events.js:376:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
    at TCP.callbackTrampoline (internal/async_hooks.js:134:14)

西尔斯

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。