gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 23:59:55 24 4
gpt4 key购买 nike

我设计了一个数据层 API 来使用 trireme-jdbc 建立 openge 数据库连接。当我使用 cygwin 通过 trireme 命令运行文件时,代码工作正常,但是当我使用命令“a127 project start”通过 apigeetool 启动完整项目时,它会抛出一些关于 trireme 的错误。我已经将通用池包与 trireme-jdbc 一起用于数据库连接池。下面是运行我的 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');
});

最佳答案

我不是 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 ; 

关于java - 如何使用 Apigeetool 在 Apigee 上部署 Trireme 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38527887/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com