facebooklinkedinrsstwitterBlogAsset 1PRDatasheetDatasheetAsset 1DownloadForumGuideLinkWebinarPRPresentationRoad MapVideofacebooklinkedinrsstwitterBlogAsset 1PRDatasheetDatasheetAsset 1DownloadForumGuideLinkWebinarPRPresentationRoad MapVideo

Actian Zen and Python

Programmers can access Actian Zen in many ways. In this tutorial, we will be using Python 3.7, but the examples in this guide should work with Python 2.7 as well.

This page covers the topics listed at right.

Python Setup

Make sure you have a recent version of Python installed on your system.

Windows and Python

For Windows 10, download and run the latest Python 3 installer if you don’t already have a version of Python installed.

During the installation process, it is important that you check the box to add Python to your PATH, otherwise you won’t be able to directly use Python in your command prompt or terminal.

When installing, make sure to choose the option to install everything including PIP, the popular Python package system. We will use PIP later to install other packages.

Linux and Python

Many Linux distributions include Python by default. Check the Python version by running the “python -V” command in a terminal window. If Python 3 is not already installed, use your distribution’s package manager to install it.

You may also need to install required Python libraries. For example, on a Debian-based distribution that uses the apt-get package manager:

sudo apt-get update && sudo apt-get install build-essential libssl-dev libffi-dev python3-dev python3-distutils

Use the package manager on your distribution of choice to install any necessary libraries.

Python and ODBC

A popular interface for communicating with databases is ODBC, which provides a common API for writing to almost any SQL-compliant database.

An ODBC driver is installed with Actian Zen Server, and the included Demodata sample database is preconfigured to accept ODBC API commands.

For programming with Python, the pyodbc module provides a free, open-source ODBC bridge that uses native Python data types and allows you to easily access databases using common syntax.

To install pyodbc with PIP, open a terminal or command prompt and run the following command:

pip install pyodbc

With pyodbc installed, you’re ready to move on to the next step of the tutorial, where you will write simple Python code to communicate with the database.

For more information, see Accessing Actian Zen with ODBC.

Python and the Btrieve 2 API

The Btrieve 2 SDK for Actian Zen provides a mature API that is ideal for working with the data that’s already in an application. Unlike SQL-based database access such as with ODBC or similar drivers, Btrieve 2 represents tables in native data structures as individual files in the file system to store a database and its indexes.

For more information, see Accessing Actian Zen with the Btrieve 2 API.