Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebird, TimeStamp,Windows: Process finished with exit code 0xC0000005 #102

Open
mtrezzi opened this issue Mar 30, 2016 · 5 comments
Open

Comments

@mtrezzi
Copy link

mtrezzi commented Mar 30, 2016

Hi,

I'm using node-odbc with firebird 2.5 and a dialect 3 database.
Node.js crashes and the process finishes with exit code 0xC0000005 when my application executes a query containing timestamp fields .

Here is the code to create table and insert data:

CREATE TABLE TIMETEST (ID INTEGER PRIMARY KEY NOT NULL, TIMEFIELD TIMESTAMP);
COMMIT;
INSERT INTO TIMETEST (ID, TIMEFIELD) VALUES (2, '03-30-2016 12:00:00');
COMMIT;

Here is the node.js code:

var db = require('odbc')(),
    cn='DSN=MYDB;Uid=SYSDBA;Pwd=masterkey';

console.log('Opening');
db.open(cn, function (err) {
    console.log(err ? 'CONNECTION ERROR: ' + err : 'CONNECTED');

    var query =  'SELECT * FROM TIMETEST ';
    db.query(query, function (err, data) {
        console.log(err ? 'QUERY ERROR: ' + err : 'NO QUERY ERROR');
        console.log(data);
        console.log('Closing');
        db.close(function () {
            console.log('done');
        });
    });
});

I never get "closing" nor "done" log messages, but the system crashes during "db.query" execution.

Here is the WebStorm debugger console output:

Opening
CONNECTED

Process finished with exit code -1073741819 (0xC0000005)
@wankdanker
Copy link
Collaborator

Hi @mtrezzi! I'm not sure I can help you all the way through this, but you might try enabling debugging in the odbc module (https://github.com/wankdanker/node-odbc#debug). At least we can then see where it is getting internally before crashing.

@mtrezzi
Copy link
Author

mtrezzi commented Mar 31, 2016

Hi @wankdanker!
I enabled debugging in the odbc module.
Now the program prints out continuously the following line:

ODBC::GetColumnValue - String: index=2 name=T type=93 len=38 value=2 ret=0 bufferLength=1048575

The column 2 is the TIMESTAMP
Now the program remains stuck in a loop.

@wankdanker
Copy link
Collaborator

My best guess is that the Firebird TimeStamp types maps to some ODBC type other than SQL_DATETIME or SQL_TIMESTAMP. A quick look at /usr/include/sql.h indicates that SQL_TYPE_TIMESTAMP has the value 93 that is being reported in the debug output. I'd suggest trying to add a case for SQL_TYPE_TIMESTAMP at https://github.com/wankdanker/node-odbc/blob/master/src/odbc.cpp#L418, then recompile and try again.

@mtrezzi
Copy link
Author

mtrezzi commented Apr 14, 2016

Thank you for your kind cooperation and your prompt reply.
I will try it and I will let you know.

Massimiliano


Da: Dan VerWeire [email protected]
Inviato: giovedì 14 aprile 2016 15.37
A: w1nk/node-odbc
Cc: Massimiliano Trezzi
Oggetto: Re: [w1nk/node-odbc] Firebird, TimeStamp,Windows: Process finished with exit code 0xC0000005 (#102)

My best guess is that the Firebird TimeStamp types maps to some ODBC type other than SQL_DATETIME or SQL_TIMESTAMP. A quick look at /usr/include/sql.h indicates that SQL_TYPE_TIMESTAMP has the value 93 that is being reported in the debug output. I'd suggest trying to add a case for SQL_TYPE_TIMESTAMP at https://github.com/wankdanker/node-odbc/blob/master/src/odbc.cpp#L418, then recompile and try again.

You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com//issues/102#issuecomment-209945578

@mtrezzi
Copy link
Author

mtrezzi commented Apr 29, 2016

Hi @wankdanker!
Your solution that you suggest works.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants