Natural Pleistocene Monsters

    jt400

    0.1.2 • Public • Published

    jt400 Dependency Status NPM version

    NPM

    Download jt400.jar and copy in your path.

    More info: http://jt400.sourceforge.net/

    Install

    npm install jt400
    

    Custom config connection

    • Host: 127.0.0.1
    • Database: myDatabase
    • User: myUser
    • Password: myPassword

    app.js

    var Database = require('jt400');
    var database = new Database();
    
    var config = {
      libpath: __dirname + '/jt400.jar',
      drivername: 'com.ibm.as400.access.AS400JDBCDriver',
      url: 'jdbc:as400://127.0.0.1/myDatabase;user=myUser;password=myPassword'
    };
    
    database.initialize(config);
    
    // SELECT statements must be run with execute()
    database.execute('SELECT * FROM foo');
    
    database.on('execute', function(error, results) {
      if (error) {
        console.log(error);
      }
      else {
        console.log(results);
      }
    });
    
    //INSERT and UPDATE statements must be run with executeUpdate()
    database.executeUpdate('INSERT INTO foo (bar) VALUES ("bar")');
    
    database.on('executeUpdate', function(error, rowCount) {
      if (error) {
        console.log(error);
      }
      else {
        console.log(rowCount);
      }
    });
    
    //CALL stored procedure must use executeStoredProc()
    var outputParameters = [{
      Index: 1,
      DataType: 1
    }];
    
    database.executeStoredProc("CALL FOO('BAR',?)", outputParameters);
    
    database.on('executeStoredProc', function(error, results) {
      if (error) {
        console.log(error);
      }
      else {
        console.log(results);
      }
    });
    

    Run

    node app.js
    

    Based on https://npmjs.org/package/jdbc

    Install

    npm i jt400

    DownloadsWeekly Downloads

    3

    Version

    0.1.2

    License

    none

    Last publish

    Collaborators

    • paulomcnally