Btrieve 2
Loading...
Searching...
No Matches
Using Btrieve with Javascript

Using Btrieve with Javascript on Windows x64

Documented below is one approach to configuring the Btrieve 2 SDK for the Javascript programming language. In this example, we will use Visual Studio 2015 to target a native Windows x64 environment. It is assumed that Zen is already installed and running.

  • Install SWIG and Javascript if not already installed.
  • Install the Btrieve 2 Windows SDK for Zen.
  • Generate, build, and install Btrieve Javascript.
    • Open the Visual Studio x64 Native Tools Command Prompt.
    • Change directory into the Btrieve 2 SDK directory.
    • Change directory into the SWIG Btrieve Javascript directory.
      • cd swig\btrieveJavascript
    • Generate Btrieve Javascript.
      • C:\swigwin-4.0.2\swig.exe -cppext cpp -outcurrentdir -javascript -node -c++ -I..\..\include btrieveJavascript.swig
        • Note that the path to SWIG used above may differ.
        • Note that Node.js is specified.
    • Build Btrieve Javascript.
      • "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\node-gyp.cmd" configure
      • "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\node-gyp.cmd" build
        • Note that the path to Node.js used above may differ.
        • Note that Node.js version 10.22 was used.
    • Install Btrieve Javascript.
      • copy build\Release\btrieveJavascript.node "c:\Program Files\Actian\Zen\bin"
        • You may need elevated permissions to perform this copy.
    • Execute the Btrieve Javascript sample program.
      • "C:\Program Files\nodejs\node.exe" ..\..\samples\btest.js 9
        • You should see the output "record: (9, 81, 3)".
        • Note that the path to Javascript used above may differ.
        • You may need to change the permissions of the current directory if you receive the error "AssertionError [ERR_ASSERTION]: Error: BtrieveClient.FileCreate():94:Permission error".

Using Btrieve with Javascript on Ubuntu 20 x64

Documented below is one approach to configuring the Btrieve 2 SDK for the Javascript programming language. In this example, we will use the Node.js package to target an Ubuntu 20 x64 environment. It is assumed that Zen is already installed and running.

  • Install SWIG and Javascript if not already installed.
    • Open a terminal window as a non-"root" user.
    • sudo apt install swig
    • sudo apt install node-gyp
  • Install the Btrieve 2 Linux SDK for Zen.
  • Generate, build, and install Btrieve Javascript.
    • Open a terminal window as a non-"root" user.
    • Change directory into the Btrieve 2 SDK directory.
    • Change directory into the SWIG Btrieve Javascript directory.
      • cd swig/btrieveJavascript
    • Generate Btrieve Javascript.
      • swig -cppext cpp -outcurrentdir -javascript -node -c++ -I../../include btrieveJavascript.swig
        • Note that Node.js is specified.
    • Build Btrieve Javascript.
      • node-gyp configure
      • node-gyp build
    • Install Btrieve Javascript.
      • sudo cp build/Release/btrieveJavascript.node /usr/local/actianzen/lib64
    • Execute the Btrieve Javascript sample program.
      • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/actianzen/lib64
      • node ../../samples/btest.js 9
        • You should see the output "record: (9, 81, 3)".
        • You may need to change the permissions of the current directory if you receive the error "AssertionError [ERR_ASSERTION]: Error: BtrieveClient.FileCreate():94:Permission error".