How to use the ibm_db.open function in ibm_db

To help you get started, we’ve selected a few ibm_db examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SaifRehman / ICP-Airways / backend-test / app.js View on Github external
var ibmdb = require('ibm_db');

ibmdb.open("DATABASE=SAMPLE;HOSTNAME=localhost;UID=db2inst1;PWD=db2inst1-pwd;PORT=50000;PROTOCOL=TCPIP", function (err,conn) {
  if (err) return console.log(err);
  
  conn.query('select * from DB2INST1.VSTAFAC2', function (err, data) {
    if (err) console.log(err);
    else console.log(data);

    conn.close(function () {
      console.log('done');
    });
  });
});
github SaifRehman / ICP-Airways / icp-backend / signup-microservice / dist / App.js View on Github external
router.post('/createUser', function (req, res, next) {
            ibmdb.open(_this.connectionString, function (err, conn) {
                conn.prepare("insert into SAMPLE.UserData (LastName, FirstName, Location, Email, Password, Age) VALUES (?, ?, ?, ?, ?, ?)", function (err, stmt) {
                    if (err) {
                        console.log(err);
                        return conn.closeSync();
                    }
                    console.log(req.body.lastName);
                    stmt.execute([req.body.lastName, req.body.firstName, req.body.location, req.body.email, passwordhash.generate(req.body.password), req.body.age], function (err, result) {
                        if (err)
                            console.log(err);
                        else {
                            res.json({
                                message: "sucessful"
                            });
                            result.closeSync();
                        }
                        conn.close(function (err) { });
github SaifRehman / ICP-Airways / icp-backend / listing-schedule / dist / App.js View on Github external
router.get('/listFlightsByID/:id', (req, res, next) => {
            ibmdb.open(this.connectionString, function (err, conn) {
                conn.prepare('SELECT * FROM SAMPLE.FlightsData WHERE ID=?', function (err, stmt) {
                    if (err) {
                        console.log('errorr', err);
                    }
                    stmt.execute([req.params.id], function (err, result) {
                        result.fetch(function (err, data) {
                            if (err) {
                                console.error(err);
                                res.status(401).json({ message: "Server error" });
                                result.closeSync();
                            }
                            else {
                                if (data) {
                                    res.json({
                                        data,
                                        message: true
github SaifRehman / ICP-Airways / icp-backend / booking-microservice / dist / App.js View on Github external
router.post('/book', this.ensureToken, (req, res, next) => {
            ibmdb.open(this.connectionString, function (err, conn) {
                conn.prepare("insert into SAMPLE.Booking (TS, Checkin, UserID, FlightID) VALUES (CURRENT TIMESTAMP, '0', ?, ?)", function (err, stmt) {
                    if (err) {
                        console.log(err);
                        return conn.closeSync();
                    }
                    console.log(req.body.lastName);
                    stmt.execute([req.body.UserID, req.body.FlightID], function (err, result) {
                        if (err)
                            console.log(err);
                        else {
                            res.json({
                                message: "sucessful"
                            });
                            result.closeSync();
                        }
                        conn.close(function (err) { });
github SaifRehman / ICP-Airways / icp-backend / checkin-microservice / src / App.ts View on Github external
router.get('/checkin/:bookid/:userid', this.ensureToken, (req, res, next) => {
      ibmdb.open(this.connectionString, function (err, conn) {
        conn.prepare("UPDATE SAMPLE.Booking SET Checkin = '1' WHERE FlightID = ? AND UserID=? "
          , function (err, stmt) {
            if (err) {
              console.log('errorr', err);
              res.json({
                message: true
              });
            }
            stmt.execute([req.params.bookid, req.params.userid], function (err, result) {
              console.log(req.params.bookid, req.params.userid)
              if (err) {
                console.log('error', err)
                res.json({
                  message: true
                });
              }
github SaifRehman / ICP-Airways / icp-backend / checkin-microservice / dist / App.js View on Github external
router.get('/checkin/:bookid/:userid', this.ensureToken, (req, res, next) => {
            ibmdb.open(this.connectionString, function (err, conn) {
                conn.prepare("UPDATE SAMPLE.Booking SET Checkin = '1' WHERE FlightID = ? AND UserID=? ", function (err, stmt) {
                    if (err) {
                        console.log('errorr', err);
                        res.json({
                            message: true
                        });
                    }
                    stmt.execute([req.params.bookid, req.params.userid], function (err, result) {
                        console.log(req.params.bookid, req.params.userid);
                        if (err) {
                            console.log('error', err);
                            res.json({
                                message: true
                            });
                        }
                        else {
github SaifRehman / ICP-Airways / icp-backend / login-microservice / dist / App.js View on Github external
router.post('/login', (req, res, next) => {
            ibmdb.open(this.connectionString, function (err, conn) {
                conn.prepare('SELECT * FROM SAMPLE.UserData WHERE Email=?', function (err, stmt) {
                    if (err) {
                        console.log(err);
                    }
                    stmt.execute([req.body.email], function (err, result) {
                        result.fetch(function (err, data) {
                            if (err) {
                                console.error(err);
                                res.status(401).json({ message: "Server error" });
                                result.closeSync();
                            }
                            else {
                                console.log(JSON.stringify(data));
                                if (!data) {
                                    res.status(401).json({ message: "Please signup, no email exists" });
                                }
github SaifRehman / ICP-Airways / icp-backend / signup-microservice / src / App.ts View on Github external
router.post('/createUser', (req, res, next) => {
      this.firstName = req.body.firstName;
      this.lastName = req.body.lastName;
      this.age = req.body.age;
      this.email = req.body.email;
      this.password = req.body.password;
      this.location = req.body.location;
      this.password = passwordhash.generate(this.password);
      ibmdb.open(this.connectionString, function (err, conn) {
        conn.prepare("insert into UsersTable (LastName, FirstName, Location, Email, Password, Age) VALUES (?, ?, ?, ?, ?, ?)", function (err, stmt) {
          if (err) {
            //could not prepare for some reason
            console.log(err);
            return conn.closeSync();
          }
          //Bind and Execute the statment asynchronously
          stmt.execute([this.lastName, this.firstName, this.location, this.email, this.password, this.age], function (err, result) {
            if (err) console.log(err);
            else{
              res.json({
                message: "sucessful"
              });
               result.closeSync();
            }
            //Close the connection
github SaifRehman / ICP-Airways / icp-backend / login-microservice / src / App.ts View on Github external
router.post("/createUser", (req, res, next) => {
      ibmdb.open(this.connectionString, function(err, conn) {
        conn.prepare(
          "insert into SAMPLE.UserData (LastName, FirstName, Location, Email, Password, Age, Tier) VALUES (?, ?, ?, ?, ?, ?, ?)",
          function(err, stmt) {
            if (err) {
              console.log(err);
              return conn.closeSync();
            }
            stmt.execute(
              [
                req.body.lastName,
                req.body.firstName,
                req.body.location,
                req.body.email,
                passwordhash.generate(req.body.password),
                req.body.age,
                req.body.tier
github plotly / falcon / backend / persistent / datastores / ibmdb2.js View on Github external
client = new Promise(function(resolve, reject) {
            ibmdb.open(connectionString, function(err, conn) {
                if (err) reject(err);
                else resolve(conn);
            });
        });

ibm_db

IBM DB2 and IBM Informix bindings for node

MIT
Latest version published 1 month ago

Package Health Score

80 / 100
Full package analysis

Popular ibm_db functions