New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-teradata

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-teradata

Teradata for Node.js

  • 1.6.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
71
decreased by-6.58%
Maintainers
1
Weekly downloads
 
Created
Source

node-teradata

GitHub version Downloads Build status

Teradata for Node.js


Features

  • Asynchronous
  • Read/Write
  • Prepared Statements
  • Connection Pool
  • Keep Alive

Installation

npm install node-teradata

Java

node-teradata uses JDBC to communicate with Teradata:

  1. Download and install JDK 8 (1.8.0 u112)
  2. Make sure Java is included in your system path

Other versions of the JDK may work, but they have not been tested

Teradata

A JDBC driver is provided by Teradata for communicating with their databases via Java:

  1. Download the Teradata JDBC Driver (15.10.00.33)
  2. Create a "jars" folder in the root of your app
  3. Extract the archive's contents into the folder:
  • tdgssconfig.jar
  • terajdbc4.jar

Other versions of the Teradata JDBC Driver may work, but they have not been tested

Usage

Include module

var Teradata = require('node-teradata');

Create an instance

var teradata = new Teradata(config);

Example Config

var config = {
  url: 'jdbc:teradata://myserver',
  username: 'MyUsername',
  password: 'MyPassword',
  driver: './jars/',
  minPoolSize: 1,
  maxPoolSize: 100,
  keepalive: {
    interval: 60000,
    query: 'SELECT 1',
    enabled: true
  },
  jvmOptions: ['-Xrs']
};

Examples

Read
var id = 7;
var sql = 'SELECT * FROM MyDatabase.MyTable WHERE Id = ' + id;

return teradata.read(sql)
  .then(function(response) {
    console.log(response);
  });
Write
var id = 7;
var sql = 'DELETE FROM MyDatabase.MyTable WHERE Id = ' + id;

return teradata.write(sql)
  .then(function(count) {
    console.log(count);
  });
Read Prepared Statement
Anonymous Parameters
var id = 7;
var sql = 'SELECT * FROM MyDatabase.MyTable WHERE Id = ?';

return teradata.readPreparedStatement(sql, [
    teradata.createPreparedStatementParam(1, 'Int', Number(id))
  ])
  .then(function(response) {
    console.log(response);
  });
Named Parameters
var id = 7;
var sql = 'SELECT * FROM MyDatabase.MyTable WHERE Id = :id';

return teradata.readPreparedStatement(sql, [
    teradata.createPreparedStatementParam('id', 'Int', Number(id))
  ])
  .then(function(response) {
    console.log(response);
  });
Write Prepared Statement
Anonymous Parameters
var id = 7;
var username = 'Foo';
var sql = 'UPDATE MyDatabase.MyTable SET Username = ? WHERE Id = ?';

return teradata.writePreparedStatement(sql, [
    teradata.createPreparedStatementParam(1, 'String', username),
    teradata.createPreparedStatementParam(2, 'Int', Number(id))
  ])
  .then(function(count) {
    console.log(count);
  });
Named Parameters
var id = 7;
var username = 'Foo';
var sql = 'UPDATE MyDatabase.MyTable SET Username = :username WHERE Id = :id';

return teradata.writePreparedStatement(sql, [
    teradata.createPreparedStatementParam('id', 'Int', Number(id)),
    teradata.createPreparedStatementParam('username', 'String', username)
  ])
  .then(function(count) {
    console.log(count);
  });

See the docs for more information

Keywords

FAQs

Package last updated on 13 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc