# jt400

> Implementation http://jt400.sourceforge.net/ on JavaScript

Latest version **0.1.2** (published 2016-11-17) · 0 weekly downloads

## Install

```sh
npm install jt400
pnpm add jt400
yarn add jt400
bun add jt400
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2016-11-17 |
| First published | 2013-11-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Paulo McNally |
| Maintainers | paulomcnally |
| Keywords | as400, IBM, java, db2 |

## Links

- npm: https://www.npmjs.com/package/jt400
- Repository: https://github.com/paulomcnally/jt400.js
- Homepage: https://github.com/paulomcnally/jt400.js#readme
- Issues: https://github.com/paulomcnally/jt400.js/issues/new
- npm.io page: https://npm.io/package/jt400

## Dependencies (2)

- [java](https://npm.io/package/java.md) ^0.6.0
- [string](https://npm.io/package/string.md) ^3.0.0

## Recent versions

- 0.1.2 (latest) — 2016-11-17
- 0.1.1 — 2016-01-12
- 0.1.0 — 2014-12-08
- 0.0.2 — 2014-06-20
- 0.0.1 — 2013-11-20

## README

# jt400 [![Dependency Status](https://david-dm.org/paulomcnally/jt400.js.png)](https://david-dm.org/paulomcnally/jt400.js) [![NPM version](https://badge.fury.io/js/jt400.png)](http://badge.fury.io/js/jt400)

[![NPM](https://nodei.co/npm/jt400.png)](https://nodei.co/npm/jt400/)

Download [jt400.jar](https://github.com/paulomcnally/jt400.js/raw/master/lib/jt400.jar) and copy in your path.

More info: [http://jt400.sourceforge.net/](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](https://npmjs.org/package/jdbc)

---
_Source: https://npm.io/package/jt400 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
