npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

teradata

v0.1.1

Published

Simple node-jdbc wrapper for teradata with promisified functions

Downloads

30

Readme

node-teradata

Simple node-jdbc wrapper for teradata with promisified functions

NOTE: I do not claim ownership of, and will not support the teradata jdbc drivers. This package is in no way endorsed by teradata

A simple module to make working with teradata connections in node easier. Most of the work is done by the awesome node-jdbc module. I have simply provided a wrapper to save some time. It allows you to run queries against a teradata database. This wrapper returns bluebird promises to avoid nested callbacks. This module mostly follows the node-jdbc syntax for executing queries.

Setup

Add teradata jars to your Project:

  1. Download Drivers
  2. Create a directory named "jars" at the root of your project
  3. Extract downloaded drivers
  4. Copy "tdgssconfig.jar" and "terajdbc4.jar" into the newly created jars directory

** Alternatively you can make use of the teradataJarPath option and store your jars wherever you like

Install module

npm install teradata

NOTE: on OSX 10.10 with java 8.60 I had to set the CXX environment variable:

export CXX=gcc

then:

npm rebuild

Include module:

var Teradata = require("teradata");

Connect:

Teradata.connect('[url]' ,'[user]', '[password]')
    .then(function () {    
        // you are now connected
     });

You can also specify some options when connecting:

var options = {
    verbose: true,
    teradataJarPath: "[path-to-teradata-jdbc-drivers-directory]"
};
Teradata.connect('[url]' ,'[user]', '[password]')
    .then(function () {    
        // you are now connected
     });

verbose: turns on logging within the teradata package. can be useful for debugging

teradataJarPath: Allows you to store your downloaded Teradata JDBC jars somewhere other than the root of your project directory

Disconnect:

Teradata.disconnect()
    .then(function () {    
        // you are now disconnected
     });

Example Insert

Make sure to change the url, username, password, and insert query. Call .executeUpdate(query) for updates and inserts

    var Teradata = require("teradata");
        
    Teradata.connect('[url]' ,'[user]', '[password]')
        .then(function () {       
            return Teradata.executeUpdate("[insert query]");
        })
        .then(function (update count) {
            console.log("Updated %d records", updateCount);
            return Teradata.disconnect();
        });        

Example Select

Make sure to change the url, username, password, and select query. You can also optionally set a limit by changing [limit]

     var Teradata = require("teradata");
         
     Teradata.connect('[url]' ,'[user]', '[password]')
         .then(function () {       
             return Teradata.executeQuery("[select query]", [limit]);
         })
         .then(function (update count) {
             console.log("Updated %d records", updateCount);
             return Teradata.disconnect();
        });  

Dependencies

node-jdbc

bluebird

chalksay

Teradata jdbc driver

Contribute

Pull requests are welcome and will probably result in quicker changes than issues. Issues are of course welcome, and I will respond ASAP.

License

Module specific code licensed under MIT See Dependencies for included module licenses See Teradata site for JDBC driver