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.

In trying to learn the JavaScript External Environment, I have encountered the following problem.

According to the documentation and examples, you can connect to the callers database using 'sa_dbcapi_handle' in place of the connection parameters.

While this works on Linux, it fails on Windows with the message:

Could not execute statement.
Procedure 'test2' terminated with unhandled exception 'Error: Code: -739
Msg: db_init has not been called or the call to db_init failed'
SQLCODE=-91, ODBC 3 State="HY000"
Line 15, column 1
CALL test2()

I've created a github gist (https://gist.github.com/twilkinson/6036702fae6f29f62107 ) that illustrates the problem.

There are 2 files:

  1. First copy tests.js to C:\Temp\tests.js.
  2. Then using ISQL, connect to the 'SQL Anywhere 17 Demo' database and execute tests.sql.

I'm running Windows-7, SA17 Developers Edition (17.0.0.1211) and node (v0.10.40).

Has anyone else seen this? Any suggestions?

Thanks,

asked 10 Feb '16, 11:07

Terry%20Wilkinson's gravatar image

Terry Wilkinson
746303548
accept rate: 25%

edited 10 Feb '16, 11:13

There are examples of using serverside connectivity this way in the "%sqlanysamp17%\SQLAnywhere\ExternalEnvironments\JavaScript\"

Do serverside.js and serverside.sql show the same issue in your setting as well?

(10 Feb '16, 12:45) Nick Elson S...

Yes. I tried to run those and had the same problem.

Could not execute statement.
Procedure 'sjs_create_table' terminated with unhandled exception 'Error:
Code: -739 Msg: db_init has not been called or the call to db_init
failed'
SQLCODE=-91, ODBC 3 State="HY000"
Line 29, column 1
You can continue executing or stop.
-- Tests
call sjs_create_table()

(10 Feb '16, 13:00) Terry Wilkinson

Never mind.

I just reproduce this with the 3rd example from "How to use JavaScript from the Database" page.

(10 Feb '16, 13:49) Nick Elson S...
Comment Text Removed

It appears to not reproduce with V5.6.0 ... I was using the same NodeJS V4.3.0 as you are running when I reproduced this ... but the issue was not reproduced by a collegue with V5.6.0. {thanks Jack}

permanent link

answered 11 Feb '16, 17:31

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
7.3k35107
accept rate: 32%

Though it still fails for me on a Windows 8 imaged laptop. hmmmm

(11 Feb '16, 18:02) Nick Elson S...

Actually, I'm running nodejs 0.10.40 - waiting for the update to the SA17 Developer Edition for node 4+ support.

(11 Feb '16, 20:23) Terry Wilkinson
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:

×248
×49
×24
×21

question asked: 10 Feb '16, 11:07

question was seen: 6,378 times

last updated: 11 Feb '16, 20:26