Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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 ---------

asked 03 Mar '16, 09:01

mhelfrich's gravatar image

mhelfrich
11112
accept rate: 0%

edited 03 Mar '16, 09:37

What version of node.js are you using?

(03 Mar '16, 10:44) Graeme Perrow

This problem was related to a bug in the node-sqlanywhere driver v1.0.7 but would only show up on node.js v0.10. Version 1.0.8 of the driver fixes this problem and has been posted to github.com and npmjs.com.

permanent link

answered 04 Mar '16, 16:11

Graeme%20Perrow's gravatar image

Graeme Perrow
9.6k379124
accept rate: 54%

I'm not familiar with Meteor and I can't tell from the info that you have posted (some formatting of the stack trace would help)... but a common problem seen on Unix platforms is forgetting to source the sa_config.sh file before starting the process (in this case node). So if you did not source sa_config.sh before starting your node.js process then I would recommend doing that and see if it fixes your issue.

I'd also recommend trying a basic test (e.g. the sample on the npm page: https://www.npmjs.com/package/sqlanywhere) to see if it works.

HTH

permanent link

answered 03 Mar '16, 09:24

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297
accept rate: 41%

edited 03 Mar '16, 09:30

Thank you Mark for your answer.

I source the sa_config.sh file before i start my app. Otherwise i cant even connect to my database. Sadly that isn't the problem.

And my example code is nearly the basic example from the npm page just with some meteor specific handling of the callbacks. But the basic example from the npm page causes the error on my linux server but not on my windows 7 system.

(03 Mar '16, 09:43) mhelfrich
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×95
×68
×21

question asked: 03 Mar '16, 09:01

question was seen: 2,269 times

last updated: 04 Mar '16, 16:11