Hi there,
i am playing a liitle bit around with meteor and trying to connect to a sql anywhere 12 database. And i am stuck at the moment. Maybe someone has a idea about this.
I have a basic test app with a html page with a button on it to call my function and this is the code for the function:
if (Meteor.isClient) {
Template.body.events({
'click button'() {
Meteor.call('sqlAnywhereTest');
}
});
}
Meteor.methods({
sqlAnywhereTest() {
if (!this.isSimulation) {
const sql = Meteor.npmRequire('sqlanywhere');
const db = sql.createConnection();
const dbParams = {
Host: '192.168.1.10:49156',
UserId: 'user',
Password: 'password'
};
const dbConnect = Meteor.wrapAsync(db.connect, db);
const dbExec = Meteor.wrapAsync(db.exec, db);
const dbDisconnect = Meteor.wrapAsync(db.disconnect, db);
try {
dbConnect(dbParams);
var result = dbExec('Some SQL Statement');
console.log(result);
dbDisconnect();
} catch (error) {
console.log(error);
}
}
}
});
This code is running perfect on my windows 7 dev PC, but for my project it has to run on a ubuntu / debian linux server.
I set up an Ubuntu test server, installed everything i need, i think. Installed all requirements for the npm package "sqlanywhere" and also installed the sql anywhere 12 client driver for linux.
My app runs and when i click the button, then my app logs the data fetched in the result variable and then crashes, with this error
W20160229-18:41:51.394(1)? (STDERR)
W20160229-18:41:51.396(1)? (STDERR) /home/malte/test/.meteor/local/build/programs/server/packages/meteor.js:1089
W20160229-18:41:51.400(1)? (STDERR) Fiber(runWithEnvironment).run(); W20160229-18:41:51.402(1)? (STDERR) ^
W20160229-18:41:51.410(1)? (STDERR) Stacktrace (dead0000-dead0001) 0xc2c4ff414b1 0x21fa94604401:
W20160229-18:41:51.410(1)? (STDERR)
==== Stack trace ============================================
W20160229-18:41:51.411(1)? (STDERR)
W20160229-18:41:51.411(1)? (STDERR) Security context: 0xc2c4ff57281 <JS Object>#0# W20160229-18:41:51.412(1)? (STDERR) 1: DefaultString [native runtime.js:646] (this=0xc2c4ff41bf1 <JS Object>#1#,a=0xc2c4ff414b1 <FixedArray[66]>#2#) W20160229-18:41:51.412(1)? (STDERR) 2: ToString(aka ToString) [native runtime.js:555] (this=0xc2c4ff04121 <undefined>,a=0xc2c4ff414b1 <FixedArray[66]>#2#)
W20160229-18:41:51.413(1)? (STDERR) 3: ToStringCheckErrorObject(aka ToStringCheckErrorObject) [native messages.js:95] (this=0xc2c4ff04121 <undefined>,a=0xc2c4ff414b1 <FixedArray[66]>#2#)
W20160229-18:41:51.413(1)? (STDERR) 4: ToDetailString(aka ToDetailString) [native messages.js:110] (this=0xc2c4ff04121 <undefined>,a=0xc2c4ff414b1 <FixedArray[66]>#2#) W20160229-18:41:51.414(1)? (STDERR) 5: FormatString(aka FormatString) [native messages.js:51] (this=0xc2c4ff04121 <undefined>,a=0x1a4d0a5781b1 <JS Array[2]>#3#,b=0x1a4d0a576101 <JSMessageObject>#4#)
W20160229-18:41:51.414(1)? (STDERR) 6: FormatMessage(aka FormatMessage) [native messages.js:287] (this=0xc2c4ff04121 <undefined>,a=0x1a4d0a576101 <JSMessageObject>#4#) W20160229-18:41:51.414(1)? (STDERR) 7: /* anonymous */(aka /* anonymous
*/) [native messages.js:1169] (this=0xc2c4ff04121 <undefined>,h=0x1a4d0a571e79 <a TypeError>#5#)
W20160229-18:41:51.415(1)? (STDERR) 8: /* anonymous */ [native messages.js:777] (this=0x1a4d0a571e79 <a TypeError>#5#)
W20160229-18:41:51.415(1)? (STDERR) 12: GetPropertyWithoutInvokingMonkeyGetters(aka GetPropertyWithoutInvokingMonkeyGetters) [native messages.js:1224] (this=0xc2c4ff04121 <undefined>,a=0x1a4d0a571e79 <a TypeError>#5#,b=0x1689ff90e0d1 <String[7]: message>) W20160229-18:41:51.415(1)? (STDERR) 13: ErrorToStringDetectCycle(aka ErrorToStringDetectCycle) [native messages.js:1233] (this=0xc2c4ff04121 <undefined>,a=0x1a4d0a571e79 <a TypeError>#5#)
W20160229-18:41:51.415(1)? (STDERR) 14: toString [native messages.js:1254] (this=0x1a4d0a571e79 <a TypeError>#5#)
W20160229-18:41:51.416(1)? (STDERR) 15: DefaultNumber [native runtime.js:636] (this=0xc2c4ff41bf1 <JS Object>#1#,a=0x1a4d0a571e79 <a TypeError>#5#) W20160229-18:41:51.416(1)? (STDERR) 16: ToPrimitive [native runtime.js:512] (this=0xc2c4ff41bf1 <JS Object>#1#,a=0x1a4d0a571e79 <a TypeError>#5#,b=1) W20160229-18:41:51.416(1)? (STDERR) 17: ADD [native runtime.js:169] (this=0x1a4d0a571e79 <a TypeError>#5#,a=0x1689ff904221 <String[0]: >)
W20160229-18:41:51.416(1)? (STDERR) 21: prepareStackTrace [/home/malte/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/source-map-support/source-map-support.js:329] (this=0xc2c4ff49079 <JS Function Error>#6#,error=0x1a4d0a571e79 <a TypeError>#5#,stack=0x1a4d0a575d81 <JS Array[0]>#7#)
W20160229-18:41:51.424(1)? (STDERR) 22: FormatRawStackTrace(aka FormatRawStackTrace) [native messages.js:1093] (this=0xc2c4ff04121 <undefined>,a=0x1a4d0a571e79 <a TypeError>#5#,b=0x1a4d0a5723f9 <JS Array[0]>#8#)
W20160229-18:41:51.424(1)? (STDERR) 23: /* anonymous */(aka /* anonymous
*/) [native messages.js:1123] (this=0xc2c4ff04121 <undefined>,a=0x1a4d0a571e79 <a TypeError>#5#) W20160229-18:41:51.424(1)? (STDERR) 24: /* anonymous */ [native messages.js:777] (this=0x1a4d0a571e79 <a TypeError>#5#)
W20160229-18:41:51.424(1)? (STDERR)
W20160229-18:41:51.433(1)? (STDERR)
==== Details ================================================
W20160229-18:41:51.433(1)? (STDERR)
W20160229-18:41:51.433(1)? (STDERR) [1]: DefaultString [native runtime.js:646] (this=0xc2c4ff41bf1 <JS Object>#1#,a=0xc2c4ff414b1 <FixedArray[66]>#2#) { W20160229-18:41:51.434(1)? (STDERR) // stack-allocated locals W20160229-18:41:51.434(1)? (STDERR) var b = 0xc2c4ff04121 <undefined>
W20160229-18:41:51.434(1)? (STDERR) var c = 0xc2c4ff04121 <undefined> W20160229-18:41:51.434(1)? (STDERR) var d = 0xc2c4ff04121 <undefined> W20160229-18:41:51.439(1)? (STDERR) var e = 0xc2c4ff04121 <undefined> W20160229-18:41:51.439(1)? (STDERR) // expression stack (top to bottom) W20160229-18:41:51.440(1)? (STDERR) [05] : 0x1689ff909d21 <String[8]: toString> W20160229-18:41:51.440(1)? (STDERR) [04] : 0xc2c4ff414b1 <FixedArray[66]>#2# W20160229-18:41:51.440(1)? (STDERR)
--------- s o u r c e c o d e ---------
W20160229-18:41:51.440(1)? (STDERR) function DefaultString(a){?var b=a.toString;?if((%_ClassOf(b)==='Function')){?var c=%_CallFunction(a,b);?if(%IsPrimitive(c))return c;?}??var d=a.valueOf;?if((%_ClassOf(d)==='Function')){?var e=%_CallFunction(a,d);?if(%IsPrimitive(e))return e;?}??throw %MakeTypeError('cannot_convert_to_primitive',[]);?}
W20160229-18:41:51.444(1)? (STDERR)
-----------------------------------------
W20160229-18:41:51.444(1)? (STDERR) }
W20160229-18:41:51.445(1)? (STDERR)
W20160229-18:41:51.445(1)? (STDERR) [2]: ToString(aka ToString) [native runtime.js:555] (this=0xc2c4ff04121 <undefined>,a=0xc2c4ff414b1 <FixedArray[66]>#2#) { W20160229-18:41:51.450(1)? (STDERR) // expression stack (top to bottom) W20160229-18:41:51.450(1)? (STDERR) [02] : 0xc2c4ff414b1 <FixedArray[66]>#2# W20160229-18:41:51.450(1)? (STDERR) [01] : 0xc2c4ff41bf1 <JS Object>#1# W20160229-18:41:51.450(1)? (STDERR) [00] : 0xc2c4ff41bf1 <JS Object>#1# W20160229-18:41:51.451(1)? (STDERR)
--------- s o u r c e c o d e ---------
W20160229-18:41:51.451(1)? (STDERR) function ToString(a){?if((typeof(a)==='string'))return a;?if((typeof(a)==='number'))return %_NumberToString(a);?if((typeof(a)==='boolean'))return a?'true':'false';?if((typeof(a)==='undefined'))return'undefined';?return((a===null))?'null':%ToString(%DefaultString(a));?}
W20160229-18:41:51.451(1)? (STDERR)
-----------------------------------------
``W20160229-18:41:51.453(1)? (STDERR) }
W20160229-18:41:51.453(1)? (STDERR)
W20160229-18:41:51.453(1)? (STDERR) [3]: ToStringCheckErrorObject(aka ToStringCheckErrorObject) [native messages.js:95] (this=0xc2c4ff04121 <undefined>,a=0xc2c4ff414b1 <fixedarray[66]>#2#) { W20160229-18:41:51.454(1)? (STDERR) // expression stack (top to bottom) W20160229-18:41:51.454(1)? (STDERR) [01] : 0xc2c4ff414b1 <fixedarray[66]>#2# W20160229-18:41:51.458(1)? (STDERR) [00] : 0xc2c4ff04121 <undefined> W20160229-18:41:51.458(1)? (STDERR)
--------- s o u r c e c o d e ---------
What version of node.js are you using?