Informix

nested-group-icon.png

DB2

Expand all | Collapse all

SMART TRIGGERS IFX14.10

  • 1.  SMART TRIGGERS IFX14.10

    Posted 16 days ago
    Hi,

    Anybody have already try using Javascript with Smart Triggers ?
    Sample ?

    Regards

    ------------------------------
    Garcia Benjamin
    ------------------------------


  • 2.  RE: SMART TRIGGERS IFX14.10

    Posted 10 days ago
    So it may or may not be helpful, but a couple years ago I tested this out to wire up Javascript (NodeJS) with JDBC to utilize the Smart Trigger API there.  

    You do need java and the JDBC driver but it worked.

    var java = require("java");
    java.asyncOptions = {
      syncSuffix: ""
    };
    
    java.classpath.push("ifxjdbc.jar");
    
    var smartTrigger = java.newInstanceSync("com.informix.smartTrigger.IfxSmartTrigger", "jdbc:informix-sqli://localhost:20290/sysadmin:USER=informix;PASSWORD=informix");
    
    smartTrigger.timeout(10);
    
    smartTrigger.open();
    smartTrigger.addTrigger("pushtest", "informix", "ewdb", "SELECT * FROM pushtest", "smart-trigger");
    smartTrigger.tableRegistration();
    
    var foo = smartTrigger.readFromSmartBlobObject();
    console.log(foo);
    ​

    $ cat package.json
    {
      "name": "jdbc-nodejs",
      "version": "1.0.0",
      "description": "",
      "main": "app.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "Brian Hughes",
      "license": "Apache-2.0",
      "dependencies": {
        "java": "^0.8.0"
      }
    }
    ​


    ------------------------------
    Brian Hughes
    ------------------------------