KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Connecting Kdb server in node js Reply To: Connecting Kdb server in node js

  • Saidharsan

    Member
    October 3, 2024 at 4:25 am

    Below is for jkdb

    const { QConnection } = require(“jkdb”);

    const q = new QConnection({ host : “Office_Server_URL”,port: 5000, user: “user”, password: “password” });

    q.connect((err) => {

    if (err) throw err;

    console.log(“connected”);

    // send query from here

    });

    Below is for node-q

    const q = require(‘node-q’);

    const connectionDetails = {

    host : ‘Office_Server_URL’,

    port : 5000,

    user : ‘username’,

    password : ‘password’};

    q.connect(connectionDetails)

    .then((conn) => {

    return conn.k(’til 3′);

    })

    .then ((result) => {

    console.log(‘res : ‘+result);

    q.disconnect();

    })

    .catch((err) => {

    console.log(‘Error : ‘+err);

    });