title: Node.js with db2/AS400
body: <p>we have a project with Node.js that use the ibm_db to connect to the DB2/AS400.</p>
  
  <p>The problem is that it returns the following error:</p>
  
  <pre><code>[SERVER] { Error: [IBM][CLI Driver] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968
  
  [SERVER]
  
  [SERVER]   errors: [],
  
  [SERVER]   error: '[node-odbc] SQL_ERROR',
  
  [SERVER]   message: '[IBM][CLI Driver] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968\r\n',
  
  [SERVER]   state: '42968' }
  </code></pre>
  
  <p>there Is  an alternative way to connect to AS400, from node, js that does not require a license?</p>
  
  <p>This is the code we use for the connection:</p>
  
  <pre><code>"use strict";
  var models = require("../../models/index");
  var express = require("express");
  
  var db2Route = express.Router();
  const ibmdb = require("ibm_db");
  //import ibm_db
  
  
  const opts = [
      'DRIVER={IBM DB2 CLI DRIVER}',
      'DATABASE=*****',
      'PROTOCOL=TCPIP',
      'HOSTNAME=*****',
      'PORT=446',
      'UID=*****',
      'PWD=*****',
      'DBQ=,*USRLIBL'
  ];
  
  
  
  
  db2Route.route("/").post((req, res) =&gt; {
  
      ibmdb.open(opts.join(';'), (err, conn) =&gt; {
          if (err) return console.log(err);
  
          conn.query("Select * from TBFR0F" ,(err, data) =&gt;{
              if (err) console.log(err);
              else console.log(data);
              conn.close(() =&gt; console.log('done'));
          });
      });
  });
  </code></pre>