【发布时间】:2018-03-09 05:38:32
【问题描述】:
我正在尝试在 nodejs 中的 oracle 中执行一个块函数,但我没有得到任何响应,并且在 10 秒后:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Mauvaise requête: Error: ORA-12170: TNS:Connect timeout occurred
与此同时,代码继续执行。这是我的工作流程:
const jwtTokenResponse: any = await authService.userLogin(req.body);
然后在用户登录
const result = await oracleHelper.executeBlockFunction(block, bindVars);
最后是函数:
async executeBlockFunction(block: any, bindVars: any): Promise<any> {
logger.info(`--> ` + 'executeBlockFunction : ' + config.oracle.user + ' / ');
logger.info(`--> ` + 'executeBlockFunction : ' + config.oracle.password + ' / ');
logger.info(`--> ` + 'executeBlockFunction : ' + config.oracle.connectString + ' / ');
oracledb.getConnection(
{
user: config.oracle.user,
password: config.oracle.password,
connectString: config.oracle.connectString,
}).then(function (connection) {
logger.info(`--> connected`);
return connection.execute(
block,
bindVars,
).then(function (result) {
logger.info(`--> ` + result.rows);
return connection.close();
}).catch(function (error) {
logger.info(`--> ` + error.message);
return connection.close();
});
}).catch(function (error) {
throw new OracleError(
new Error(error),
);
});
}
如您所见,我检查了条目,在oracledb.getConnection 之前一切正常,之后我不明白发生了什么
有人可以帮我吗?
编辑:
有关信息executeBlockFunction 内容取自 oracleDb npm 文档:
【问题讨论】:
-
能分享一下config.oracle.connectString的内容吗
-
我看到这已经回答了,但这篇文章也可能有帮助:jsao.io/2017/07/…
标签: node.js oracle typescript npm promise