如何使用Apigeetool在Apigee上部署Trireme项目

时间:2016-07-22 13:36:27

标签: java node.js apigee openedge apigee127

我已经设计了一个数据层API来使用trireme-jdbc建立openge数据库连接。当我使用cygwin通过trireme命令运行文件时,代码工作正常,但是当我使用命令'a127 project start'通过apigeetool启动完整项目时,它会抛出一些关于trireme的错误。 我使用了通用池包和数据库连接池以及trireme-jdbc.Below是运行我的trireme而不是a127的文件。 这是一个apigee API,因此文件夹结构完全符合apigee标准,并且这里也使用了swagger。

var a127 = require('a127-magic');
var express = require('express');
var Pool = require('generic-pool').Pool;
var jdbc = require('trireme-jdbc');
var app = express();

module.exports = app; // for testing



// initialize a127 framework
a127.init(function(config) {

  // include a127 middleware
  app.use(a127.middleware(config));

  var pool = new Pool(
        {
            name : 'Suppllier Collaboration - @Anil',
            create : function(callback) {
                var connOpenedge = new jdbc.Database(
                        {
                            url : 'jdbc:datadirect:openedge://serverhost:portno;DatabaseName=xxxxx',
                            properties : {
                                user : 'db_user',
                                password : 'db_password',
                            },
                        });
                callback(null, connOpenedge);
            },
            destroy : function(client) {
                client.end();
            },
            max : 10,
            min : 2,
            idleTimeoutMillis : 30,
            log : true

        });

  // error handler to emit errors as a json string
  app.use(function(err, req, res, next) {
      console.log('we are just enter in  app.js file');

    if (typeof err !== 'object') {
      // If the object is not an Error, create a representation that appears to be
      err = {
        message: String(err) // Coerce to string
      };
    } else {
      // Ensure that err.message is enumerable (It is not by default)
      Object.defineProperty(err, 'message', { enumerable: true });
    }

    // Return a JSON representation of #/definitions/ErrorResponse
    res.set('Content-Type', 'application/json');
    res.end(JSON.stringify(err));
  });

  pool.acquire(function(err, conn) {
    if (err) {
        throw err;
    } else {
        app.get("/getData", function(req, res) {
        conn.execute('select * from "po" where "po-num" = ? and "vend-num" = ? ', 
                [4322452, 4301170 ], function(err, result, rows) {

            if (err)
                 res.json("Sorry !Error to get data from symix....");

            else
                res.json(rows);
        });

    });
    }
});


  var ip = process.env.IP || 'localhost';
  var port = process.env.PORT || 10010;
  // begin listening for client requests
  app.listen(port, ip);
  console.log('we are inside app.js file');
  console.log('try this:\ncurl http://' + ip + ':' + port + '/hello?name=Scott');
});

1 个答案:

答案 0 :(得分:1)

我不是一个SQL人,但我认为你的SQL无效或者没有返回数据。

我首先使用普通的SQL客户端测试它。如果您没有其他任何设置,Progress会发送一个名为“sqlexp”的命令行工具。您应该能够从服务器中的“proenv”窗口运行它,以查看该查询是否有效。

proenv> sqlexp -user userName -password pwd -db dbName -S port

我认为你可能会更好地将SQL写成:

select * from "PUB.po" where "PUB.po.po-num" IS NULL and "PUB.po.vend-num" IS NULL ; 
相关问题