Make faster calls using the high-speed Btrieve 2 API
If you’re using Actian Zen as your Edge Data Management platform — and naturally we think you should — you’ll find that Node.js pairs well with Zen. However, there’s more than one way to pair them. You can easily interact with Actian Zen from Node.js using SQL via ODBC, for example, and when the complexity of your interactions warrant the use of SQL that’s a perfect option.
But SQL via ODBC isn’t the fastest way to interact with Zen, and when you need speed there’s a better option: From Node.js you can access Zen data via the Btrieve 2 API. Let’s talk conceptually about how you can do this, and then we’ll dive into the practicalities of doing this. You’ll need certain software components to facilitate interaction with the Btrieve 2 API – including php, Python3, C++, and a few others that are easily downloaded – but let’s skip over the set-up for now and focus on how you can speed up access to the Zen data you need.
Using the Btrieve 2 API
- Define the libraries and components to be loaded
- Set up and variables to be used
- Define the name, location, and record characteristics of the data file to hold the results of a query
- Instantiate an instance of the BtrieveClient class used for performing engine-wide operations such as creating and deleting files and opening and closing files
- Prepare information defining the key segment
- Set the created key segment information into the index attribute
- Create a file attributes object and set the fixed record length
- Create a new Btrieve file based on the information set (BtrieveFile object is a class that handles Btrieve data files)
- Open the file
- Perform the database operations that your application requires
- Close the Btrieve File
Putting the sample through its paces
Care to run the aforementioned .js file to experience the performance of the Btrieve 2 API? There’s a more detailed Application Note that walks you through the steps to do so. So give it a try! Net-net, Node.js and Zen can provide a powerful array of options when it comes to developing mobile and IoT applications.