2.1.5 • Published 3 years ago

dh-400jdbc v2.1.5

Weekly downloads
144
License
(MIT OR Apache-2....
Repository
github
Last release
3 years ago

DH-400JDBC

JDBC Wrapper for the JT400 driver to connect to an AS400 using JDBC.

Usage

  1. Require the module:

    const jdbc = require('dh-400jdbc');
  2. Initialize the connection:

    // build the config.
    let config = {
      host: 'String',
      libraries: <String>,
      username: <String>,
      password: <String>,
      initialPoolCount: <Number>, // Optional, Defaults to 1.
      logger: <Logger Reference> // Optional, Defaults to console.
    };
    
    // initialize the module.
    jdbc.initialize(config, (err) => {
      // Do Something.
    });
  3. Execute a SQL query:

    jdbc.executeSqlString('SELECT * FROM TABLENAME', (err, results) => {
      // Do Something.
    });
  4. Execute a prepared statement query. Note: parameters is an array of values:

    jdbc.executePreparedStatement(sql, parameters, (err, results) => {
      // Do Something.
    });
  5. Execute an update prepared statement. Note: parameters is an array of values:

    jdbc.executeUpdatePreparedStatement(sql, parameters, (err, results) => {
      // Do Something.
    });
  6. Executing a stored procedure. Note: the parameters array is an array of stored procedure parameter objects.

    • You can create the objects in this format:

      {
        type: <'in' or 'out'>,
        fieldName: <String>,
        dataType: <String from sql types constants property>,
        value: <any type>
      }
    • Or use the convenience functions:

      let inputParameter = jdbc.createSPInputParameter(value);
      let outputParameter = jdbc.createSPOutputParameter(sqlDataType, fieldName);
    • Execute the statement:

      jdbc.executeStoredProcedure(sql, parameters, (err, result) => {
        // Do Something.
      });
    • Note: The result object is a key value object where the keys are the output parameter field names.

      {
        <field name 1> : <output param value 1>,
        <field name 2> : <output param value 2>,
        <field name 3> : <output param value 3>,
      }
    • Note: If your stored procedure returns 1 or more result sets you can access them through the result objects resultSets property. The resultsSetsProperty is an array of arrays where each array is a single result set:

      {
        outputParam1: <value>,
        outputParam2: <value>,
        resultSets: [
          [],
          []
        ]
      }
2.1.5

3 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.6

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.9.5

5 years ago

1.9.4

6 years ago

1.10.0

6 years ago

1.9.3

6 years ago

1.9.2

7 years ago

1.9.1

7 years ago

1.9.0

7 years ago

1.8.5

7 years ago

1.8.4

7 years ago

1.8.3

8 years ago

1.8.2

9 years ago

1.8.1

9 years ago

1.8.0

9 years ago

1.7.3

9 years ago

1.7.2

9 years ago

1.7.1

9 years ago

1.7.0

9 years ago

1.6.1

9 years ago

1.6.0

9 years ago

1.5.4

9 years ago

1.5.3

9 years ago

1.5.2

9 years ago

1.5.1

9 years ago

1.5.0

9 years ago

1.4.3

10 years ago

1.4.2

10 years ago

1.4.1

10 years ago

1.4.0

10 years ago

1.3.6

10 years ago

1.3.5

10 years ago

1.3.4

10 years ago

1.3.3

10 years ago

1.3.2

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago