No results and no error messages when executing SQL
I have successfully compiled the module for:
- Node.js 0.10.21 (ia32)
- Oracle instance Client version 12
- Python 2.7.3
- Visual Studio 2013
Server: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
I am able to connect to the server and when executing invalid SQL statements (like selecting from a table that does not exist) I receive an appropriate error message (Error: ORA-00942: table or view does not exist).
When I try to select from an existing table however, the script just stops. There is no output, no results and no error messages. My callback isn't even called :-(
I would be grateful for any pointers on where to start debugging or how to make the module be more verbose.
I am not sure, but do you have a 32Bit "ia32" node.js with a 64Bit Oracle. Not sure that this is going to work. If there is no such mismatch please post your code (test case)
... or is the jnstant client 32Bit?
Yes, the instant client is 32bit. I should be able to connect and retrieve data from an 64bit server, or?
My code
var oracle = require("oracle");
var connectData = { "hostname": "host", "user": "user", "password": "passwd", "database": "db" };
oracle.connect(connectData, function (err, connection) {
if (err || !connection) {
console.log(err);
} else {
console.log('Connected...'); // this is outputted
connection.execute("SELECT * FROM MY_DB.SOME_VIEW", [], function (err, results) {
console.log('This is never outputted, except if the above SQL throws an error');
if (err) {
console.log(err);
} else {
console.log(results);
}
connection.close();
});
console.log('This is always outputted');
}
});
"the script just stops" Do you mean it ends and you are back to the prompt? Or does it "hang"?
If it is the first, please just try to add a "sleep" (wait for some seconds) at the end of your script. As far as I understand it, the script should wait when there is still a callback waiting, but I am not completely sure.
If it hangs, I really have no idea what's going on (I am using OSX and Linux as OS).
Thanks for your reply!
If I add a timeout to my script, the callback from that timeout is not called:
//...
connection.execute("SELECT * FROM MY_DB.SOME_VIEW", [], function (err, results) {
console.log('This is never outputted, except if the above SQL throws an error');
if (err) {
console.log(err);
} else {
console.log(results);
}
connection.close();
});
setTimeout(function() {
console.log('This is not outputted, unless I comment out the above call to connection.execute');
}, 5000);
After the call to connection.execute I return to the prompt immediately, I never see that last console.log from the setTimeout, which leads me to believe that Node.js "crashes". If I comment out the call, the prompt returns after the 5 seconds have elapsed.
The timeout is inside the connect() { ... }? Please put it really at the end of your script.
My bad, it is cleaner outside of the connect, but it makes no difference :(
Even a timeout declared before, is not called:
setTimeout(function() {
console.log('This is not outputted');
}, 1000);
oracle.connect(connectData, ...
The script returns to the prompt. Shouldn't Node.js be able to tell me why the script exists?
I would consider this driver an early beta version at best ...
:D
I still would expect something like a core dump, but my experience developing on Windows is null
I have similar configuration and the same issue.
I'm adding traces and I can see that in file connection.cpp line 512: CreateColumnsFromResultSet(rs, baton, baton->columns);
The traces show that the method is invoked and executed till the very last line, but node js core dumps just after execution of that method. Traces on the next line are never shown.
Same issue....nobody was able to solve it?
I got it!! I've made the installation yesterday on my laptop. Everything works fine. Today i made the same on my office and got this issue. I've copied the running source code from my laptop to my office: same issue. The only difference was that on my laptop i used vs2010 to compile, and that was the key :) just replacing the folder Node_modeules/oracle/build with the one from my laptop and it worked fine. It has something to do with the tool you are using to compile. Using vs2010 solved the problem for me.