Truncate query not working
Truncate query not working
Whenever I try to execute a truncate statement, it does not respond. This is causing inactive sessions in the table and slowing it down.
- What error(s) you are seeing? I do not see any errors.
- What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as?
app.get('/api/RemoveAllitems', function (req, res) {
oracledb.autoCommit = true;
oracledb.getConnection(database, function (err, connection) {
if (err) res.send(err);
connection.execute("truncate table mytable", [], {}, function (err, result) {
if (err) res.send(err);
res.send(200);
doRelease(connection);
});
});
});
- What environment variables did you set? How exactly did you set them? I did nothave any problems compiling the library. I set all the environment variables mentioned in the docs.
- What is your version of Node.js? 4.6.0
- What is your version of the Oracle client (e.g. Instant Client)? How was it installed? Where it is installed? 12,1
- What is your OS and version? Windows server
- What compiler version did you use? Visual Studio2012
are you aware that in case of error you are doing res.send twice right?
if (err) res.send(err);
res.send(200);
also i'm not sure what is res.send(200), did you mean res.status(200)?
are you aware that in case of error you are doing res.send twice right?
if (err) res.send(err); res.send(200); also i'm not sure what is res.send(200), did you mean res.status(200)?
All that doesn't matter because the control never reaches the callback function.
Ok. Didnt understand that from the problem description.
@r04drunn3r I just ran the following test successfully, could you please try it?
var oracledb = require('oracledb');
var config = require('dbconfig');
oracledb.getConnection(config, function(err, connection) {
if (err) {throw err;}
connection.execute('create table t (c varchar(255))', function(err, result) {
if (err) {throw err;}
console.log('table created');
connection.execute('insert into t (c) values (\'test\')', [], {autoCommit: true}, function(err, result) {
if (err) {throw err;}
console.log('row inserted');
connection.execute('truncate table t', function(err, result) {
if (err) {throw err;}
console.log('truncate succeeded');
connection.execute('drop table t', function(err, result) {
if (err) {throw err;}
console.log('table dropped');
});
});
});
});
});
Did try that piece of code. The console just gets stuck at 'row inserted' output.
does it work via sqlplus/other sql editor?
i just checked. It does not. But then, that I believe is because of the lock created by this function.
@r04drunn3r Lock created by what function?
Lock created by the truncate query using nodejs.
your nodejs was working while you were running it via sqlplus? can you kill all processes running against that oracle and try again? than if works, retry via nodejs.
The issue seems to be specific to latest ODA X5-2 with Flash cache. Not an issue with the driver. I believe this issue can be closed.
Thanks for giving the status update. Closing as requested.