数据库连接后OrientDB服务器更改

时间:2016-05-02 10:56:38

标签: node.js orientdb orientjs

我在NodeJS服务器上使用orientjs驱动程序。我遇到的问题是我的服务器实例在第一次数据库连接后发生了变化。起初我的服务器看起来像这样:

Server {
  useToken: false,
  logger: 
   { error: [Function: bound bound ],
     log: [Function: bound bound ],
     debug: [Function] },
  transport: 
   BinaryTransport {
     domain: null,
     _events: { reset: [Function: bound ] },
     _eventsCount: 1,
     _maxListeners: Infinity,
     connecting: false,
     closing: false,
     retries: 0,
     maxRetries: 5,
     host: 'localhost',
     port: 2424,
     username: 'root',
     password: 'Orientdb',
     servers: [ [Object] ],
     currentServer: 0,
     enableRIDBags: true,
     useToken: false,
     token: null,
     sessionId: -1,
     logger: 
      { error: [Function: bound bound ],
        log: [Function: bound bound ],
        debug: [Function] },
     connection: 
      Connection {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: Infinity,
        host: 'localhost',
        port: 2424,
        socket: null,
        logger: [Object],
        enableRIDBags: true,
        closing: false,
        reconnectNow: false,
        protocol: null,
        queue: [],
        writes: [],
        remaining: null } },
  config: 
   { get: [Function: bound ],
     set: [Function: bound ],
     list: [Function: bound ] },
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: Infinity }

在我连接到数据库后,它看起来像这样:

Server {
  useToken: false,
  logger: 
   { error: [Function: bound bound ],
     log: [Function: bound bound ],
     debug: [Function] },
  transport: 
   BinaryTransport {
     domain: null,
     _events: { reset: [Function: bound ] },
     _eventsCount: 1,
     _maxListeners: Infinity,
     connecting: 
      Promise {
        _bitField: 268566529,
        _fulfillmentHandler0: undefined,
        _rejectionHandler0: undefined,
        _progressHandler0: undefined,
        _promise0: undefined,
        _receiver0: undefined,
        _settledValue: [Circular],
        _boundTo: [Circular] },
     closing: false,
     retries: 0,
     maxRetries: 5,
     host: 'localhost',
     port: 2424,
     username: 'admin',
     password: 'admin',
     servers: [ [Object] ],
     currentServer: 0,
     enableRIDBags: true,
     useToken: false,
     token: <Buffer >,
     sessionId: 19,
     logger: 
      { error: [Function: bound bound ],
        log: [Function: bound bound ],
        debug: [Function] },
     connection: 
      Connection {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: Infinity,
        host: 'localhost',
        port: 2424,
        socket: [Object],
        logger: [Object],
        enableRIDBags: true,
        closing: false,
        reconnectNow: false,
        protocol: [Object],
        queue: [],
        writes: [],
        remaining: null,
        connecting: false,
        protocolVersion: 32 },
     skipServerConnect: true },
  config: 
   { get: [Function: bound ],
     set: [Function: bound ],
     list: [Function: bound ] },
  domain: null,
  _events: 
   { reset: 
      [ [Function: bound ],
        [Function: bound ],
        [Function: bound ],
        [Function: bound ],
        [Function: bound ] ] },
  _eventsCount: 1,
  _maxListeners: Infinity }

正如您所看到的用户名和密码更改,如果我想再次使用服务器,我会收到错误:

Unhandled rejection OrientDB.RequestError: Server user not authenticated.
顺便说一下。新的用户名和密码是我的数据库的登录数据。我像这样连接到数据库:

orientserver.use({
            name: req.params.database,
            username: username,
            password: password
        });

0 个答案:

没有答案