OrientDB Server change after Database connect

124 Views Asked by At

I use the orientjs Driver on my NodeJS Server. I have the problem that my Server Instance change after the first Database Connection. At first my Server look like this:

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 }

And after I connect to the Database it looks like this:

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 }

As you can see the username and password changes and if I want to use the Server again I get an Error:

Unhandled rejection OrientDB.RequestError: Server user not authenticated.

By the way. The new username and password are the Login Data for my Database. I connect to the Database like this:

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

There are 0 best solutions below