[英]How to deploy Trireme project on Apigee using Apigeetool
I have design a data layer API to establish openedge database connection using trireme-jdbc. 我已经设计了一个数据层API来使用trireme-jdbc建立openge数据库连接。 The code is working solid when I am running the file by trireme command using cygwin, but when I start the complete project through apigeetool using command 'a127 project start' then it throws some error regarding trireme.
当我使用cygwin通过trireme命令运行文件时,代码工作正常,但是当我使用命令'a127 project start'通过apigeetool启动完整项目时,它会抛出一些关于trireme的错误。 I have used generic-pool package for database connection pooling along with trireme-jdbc.Below is the file that is running my trireme but not by a127.
我使用了通用池包和数据库连接池以及trireme-jdbc.Below是运行我的trireme而不是a127的文件。 This is a apigee API so folder structure is totally as per apigee standard and swagger is also used here.
这是一个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');
});
I am not a SQL guy but it looks to me like your SQL is either not valid or it returns no data. 我不是一个SQL人,但它看起来像你的SQL无效或它没有返回数据。
I would first test it using a plain SQL client. 我首先使用普通的SQL客户端测试它。 Progress ships a command line tool called "sqlexp" if you don't have anything else setup.
如果您没有其他任何设置,Progress会发送一个名为“sqlexp”的命令行工具。 You should be able to run it from a "proenv" window in the server to see if that query works at all.
您应该能够从服务器中的“proenv”窗口运行它,以查看该查询是否有效。
proenv> sqlexp -user userName -password pwd -db dbName -S port
And I think you might have better luck writing that SQL as: 而且我认为你可能会更好地将SQL写成:
select * from "PUB.po" where "PUB.po.po-num" IS NULL and "PUB.po.vend-num" IS NULL ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.