[英]How to verify the connection was released
I use the JDBC driver to connect to my database (made with a DBMS called SQLBase by the Centura Gupta company). 我使用JDBC驱动程序连接到我的数据库(由Centura Gupta公司使用名为SQLBase的DBMS制成)。
It is executed without problems (even I checked that the data is inserted into my database). 它的执行没有问题(即使我检查了数据是否已插入到数据库中)。
But then I execute a very simple SELECT statement and I get this error: 但是然后我执行了一个非常简单的SELECT语句,并收到此错误:
TypeError: Cannot read property 'createStatement' of undefined
at /var/apis/api.test/connections/sqlbase.dposs1.js:86:25
at JDBC.Pool.reserve (/var/apis/api.test/node_modules/jdbc/lib/pool.js:192:5)
at Object.getCenturaQuery (/var/apis/api.test/connections/sqlbase.dposs1.js:79:15)
at Object.verificarPagos (/var/apis/api.test/app/bancos/bancos.model.js:146:20)
at getFacturas (/var/apis/api.test/app/bancos/bancos.rutas.js:7:18)
at Layer.handle [as handle_request] (/var/apis/api.test/node_modules/express/lib/router/layer.js:95:5)
at next (/var/apis/api.test/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/var/apis/api.test/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/var/apis/api.test/node_modules/express/lib/router/layer.js:95:5)
at /var/apis/api.test/node_modules/express/lib/router/index.js:277:22
I am thinking that the release statement was not execute properly. 我认为release语句执行不正确。
I use this code that I saw here: https://www.npmjs.com/package/jdbc 我使用在这里看到的以下代码: https : //www.npmjs.com/package/jdbc
myConnection.release(connObj, function(err) {
if (err) {
console.log(err.message);
}
});
After release I still have this JSON connection object (I think it should't exist anymore, but it still exists): 发布后,我仍然拥有此JSON连接对象(我认为它不再存在,但仍然存在):
{
"uuid": "30271a1a-db99-4ff2-8b6a-5befcbe8fbb4",
"conn": {
"_conn": {
"warnings": null
},
"_txniso": [
"TRANSACTION_NONE",
"TRANSACTION_READ_UNCOMMITTED",
"TRANSACTION_READ_COMMITTED",
null,
"TRANSACTION_REPEATABLE_READ",
null,
null,
null,
"TRANSACTION_SERIALIZABLE"
]
},
"keepalive": false
}
How can I check if the connection was released successfully before executing a SELECT satement? 如何在执行SELECT分区之前检查连接是否已成功释放?
I think the problem is around this JSON connection object. 我认为问题在于此JSON连接对象。
Maybe it helps: I am developing with JavaScript and NodeJS on the server side. 也许有帮助:我正在服务器端使用JavaScript和NodeJS进行开发。
I'm not a JavaScript person - but am a Gupta SQLBase person , and logic tells me that you can't run a 'Select' if you have released the handle ( connection ). 我不是JavaScript的人,而是Gupta SQLBase的人,逻辑告诉我,如果释放了句柄(连接),则无法运行“选择”。 Normally , from within Gupta's own toolset , you would perform in this order: 1) Connect a Handle 2) (Optionally) set the Isolation Level to either 'Release Locks' or 'Read Committed 1, 2 or 3' .
通常,在Gupta自己的工具集中,您将按以下顺序执行: 1)连接手柄2) (可选)将隔离级别设置为“释放锁”或“读取已提交的1、2或3”。 3) Run the Update using the same Handle 4) Run a Commit using the same Handle 5) Run a Select using the same Handle 6) (Optionally) Release the Handle ( or re-use it )
3)使用相同的句柄运行更新4)使用相同的句柄运行提交 5) 使用相同的句柄运行选择6) (可选)释放该句柄(或重复使用)
excuse if I have misunderstood the way JavaScript works - can only advise on the way Gupta works. 如果我误解了JavaScript的工作方式,请谅解-只能建议Gupta的工作方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.