0

I am trying to connect to MonetDb database, unsuccessfully though :(

I am trying to replicate this approach as much as I can.

Here is the code:

var MDB = require('monetdb')();
var Client = require('ssh2').Client;
var ssh = new Client();

const config = {... this one works...the problem is not here }

var db = new Promise(function(resolve, reject){
    ssh.on('ready', function() {
      console.log("SSH connection ready !!!");
      ssh.forwardOut('127.0.0.1', 12345, 'db7', 50000, function name(err, stream) {
          if(err){
              console.log(`${err}`);
          } else {
              console.log(`SSH connection established :)`);
              var conn = new MDB({
                host     : 'db7', 
                port     : 50000, 
                dbname   : 'db', 
                user     : 'user', 
                password : 'SupedDuperPass',
                language: 'sql'
            });
            // console.log(conn);
        
            var res = conn.connect("csrhub");
            console.log("Response: ", res);
          }
      });
    }).connect(config);
});

I receive the following messages from console:

SSH connection ready !!!

SSH forwarded...

Response: { state: 'pending' }

(node:12496) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated

WARNING Socket error occurred: Error: getaddrinfo ENOTFOUND db7 db7:50000

WARNING Reconnect attempt 1/10 in 2 sec..

WARNING Socket error occurred: Error: getaddrinfo ENOTFOUND db7 db7:50000

WARNING Could not connect to MonetDB: Error: Error: getaddrinfo ENOTFOUND db7 db7:50000

WARNING Reconnect attempt 2/10 in 2 sec..

WARNING Socket error occurred: Error: getaddrinfo ENOTFOUND db7 db7:50000

WARNING Could not connect to MonetDB: Error: Error: getaddrinfo ENOTFOUND db7 db7:50000

WARNING Reconnect attempt 3/10 in 2 sec..

The ssh connection is successfully established but I cant connect to MonetDb.

Please help me make it work.

Community
  • 1
  • 1
Hairi
  • 3,318
  • 2
  • 29
  • 68

0 Answers0