forked from CITKParus/P8-ExchangeService
Установка наименования подуля в сессии при подключении к БД
This commit is contained in:
parent
d26b0d49c8
commit
d98fd1046a
@ -15,7 +15,9 @@ let dbConnect = {
|
||||
password: "parus",
|
||||
//Строка подключения к БД
|
||||
connectString: "DEMOP_CITKSERV_WAN",
|
||||
//Модуль обслуживания БД
|
||||
//Наименование модуля (для сессии БД)
|
||||
moduleName: "PARUS$ExchangeServer",
|
||||
//Подключаемый модуль обслуживания БД (низкоуровневые функции работы с СУБД)
|
||||
module: "parus_oracle_db.js"
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,8 @@ class DBConnector {
|
||||
this.connection = await this.connector.connect(
|
||||
this.connectSettings.user,
|
||||
this.connectSettings.password,
|
||||
this.connectSettings.connectString
|
||||
this.connectSettings.connectString,
|
||||
this.connectSettings.moduleName
|
||||
);
|
||||
return this.connection;
|
||||
} catch (e) {
|
||||
|
2
index.js
2
index.js
@ -35,6 +35,7 @@ try {
|
||||
a.putLog(db.MSG_TYPE_INF, "Сервер приложений подключен")
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
setTimeout(() => {
|
||||
a.disconnect()
|
||||
.then(res => {
|
||||
console.log("DISCONNECTED");
|
||||
@ -42,6 +43,7 @@ try {
|
||||
.catch(e => {
|
||||
console.log(e.code + ": " + e.message);
|
||||
});
|
||||
}, 10000);
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e.code + ": " + e.message);
|
||||
|
@ -38,13 +38,14 @@ const SLOG_STATE_ERR = "ERR"; //Ошибка (строковый код)
|
||||
//------------
|
||||
|
||||
//Подключение к БД
|
||||
const connect = async (user, password, connectString) => {
|
||||
const connect = async (user, password, connectString, moduleName) => {
|
||||
try {
|
||||
const conn = await oracledb.getConnection({
|
||||
user,
|
||||
password,
|
||||
connectString
|
||||
});
|
||||
conn.module = moduleName;
|
||||
return conn;
|
||||
} catch (e) {
|
||||
throw new Error(e.message);
|
||||
@ -174,9 +175,10 @@ const getQueueOutgoing = (connection, portionSize) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (connection) {
|
||||
connection.execute(
|
||||
"BEGIN PKG_EXS.QUEUE_OUT_GET(NPORTION => :NPORTION, RCQUEUES => :RCQUEUES); END;",
|
||||
"BEGIN PKG_EXS.QUEUE_GET(NPORTION => :NPORTION, NSRV_TYPE => :NSRV_TYPE, RCQUEUES => :RCQUEUES); END;",
|
||||
{
|
||||
NPORTION: portionSize,
|
||||
NSRV_TYPE: NSRV_TYPE_SEND,
|
||||
RCQUEUES: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||
},
|
||||
{ outFormat: oracledb.OBJECT, autoCommit: true, fetchInfo: { BMSG: { type: oracledb.BUFFER } } },
|
||||
|
Loading…
x
Reference in New Issue
Block a user