nodejs-driver/examples/README.md at develop · tarasmatsyuk/nodejs-driver

Examples Guide for Node.js Driver for Teradata

Setup

NPM

  • Ensure you have Node 12.x+ (on a Mac use Homebrew and brew install node@12.18.0)
  • Ensure you have npm 6.x+ installed.

MSVC Redistributables 2015 (Microsoft Windows only)

  • MSVC Redistributables are required to run the Teradata Node.js Driver on Microsoft Windows
  • If when running an error occurs for finding the ref.node native module then run the following command as an administrator
    • npm install --global windows-build-tools --vs2015

Typescript

  • Command line go to example directory

    • cd examples/typescript
  • Install dependencies

  • Compile all the typescript examples

    • npm run build

Javascript

  • Command line go to example directory
    • cd example/javascript
  • Install dependencies

Run Examples

Typescript

Modify the following section with correct connection parameters in each example typescript file before running:

const connParams: ITDConnParams = {
  host: '<host>',
  log: '0',
  password: '<password>',
  user: '<username>',
};

Examples

  • Create and Close a Connection
  • Simple Select of Data
  • Obtain the version number for the Teradata Database
  • Create a C User-Defined Function
  • Encrypt a password, saves the encryption key in one file, and saves the encrypted password in a second file
    • Click to view source in : typescript/src/encrypt-password.ts
    • Run example from command line: node dist/encrypt-password.js <params>
    • See comments in the example source for <params> details
  • Obtain the session information
  • Inserts data values to a table in Teradata database
  • Prepare a SQL request without executing it and obtain SQL statement metadata
  • Create and call a SQL stored procedure with a variety of parameters and dynamic result sets

Javascript

Modify the following section with correct connection parameters in each example javascript file before running:

var connParams = {
  host: '<host>',
  log: '0',
  password: '<password>',
  user: '<username>'
};

Examples

  • Create and Close a Connection
  • Simple Select of Data
  • Obtain the version number for the Teradata Database
  • Create a C User-Defined Function
  • Encrypt a password, saves the encryption key in one file, and saves the encrypted password in a second file
    • Click to view source in : javascript/src/encrypt-password.js
    • Run example from command line: node src/encrypt-password.js <params>
    • See comments in the example source for details
  • Obtain the session information
  • Inserts data values to a table in Teradata database
  • Prepare a SQL request without executing it and obtain SQL statement metadata
  • Create and call a SQL stored procedure with a variety of parameters and dynamic result sets