How to Install the Progress OpenEdge 12.0 ODBC Driver on a CentOS Server

How to Install the Progress OpenEdge 12.0 ODBC Driver on a CentOS Server
Photo by Art Markiv / Unsplash

I’m writing this because I could not find a succinct guide on how to install the Progress OpenEdge 12.0 ODBC Driver on a CentOS server.

Context

To connect to our Progress-based database, I was previously using a .jar file in a spoofed Java Runtime Environment. Python packages used included jaydebeapi and jPype1. The configuration was confusing and isolated other developers on the team. Once Oracle started auditing our company to track Java usage based on IP address, we determined it was time to evaluate other methodologies of connecting to our Progress database. Installing a driver on our CentOS server was our best bet.

I imagine at least one other developer somewhere in the world will appreciate this guide. If you are that developer, hello and welcome. I hope this serves you well.

Let’s begin!


1. OpenEdge Configuration

I was fortunate enough to stumble upon this blog post on installing OpenEdge SQL Client Access on a Ubuntu machine.

Follow the above blog post until you reach the section “Confirm correctness of OpenEdge ODBC drivers.”

The blog will instruct you to confirm success by using the command:

# in your terminal
cd /usr/dlc/odbc/lib/
ldd pgoe27.so

The output will be the same as in the blog post. You will be missing libpgicu27.so (not found).

The blog post’s solution is for Ubuntu machines. To configure libpgicu27.so in CentOS, run the following from the directory you are in (/usr/dlc/odbc/lib):

# in your terminal
sudo cp libpgicu27.so /lib64
ldd pgoe27.so

The libpgicu27.so file should now be linked to the copy you made above. Nice!


2. ~/.bashrc Configuration

Now that we’ve successfully installed the driver and all files point to where they are supposed to, we need to make sure pyodbc and other ODBC libraries can find it.

I have distilled what I’ve learned from Progress’s documentation into the following steps:

  1. We need to add some global export environment variables to our ~/.bashrc file. Add the following to your ~/.bashrc or similar configuration file.
# ~/.bashrc
export ODBCINI="/etc/odbc.ini"
export ODBCINST="/etc/odbcinst.ini"

This next one is a bit different, as it is appending rather than declaring.

Run:

# in your terminal
echo $LD_LIBRARY_PATH

Take its output (in my case, it was /usr/local/lib) and append :/usr/dlc/odbc:/usr/dlc/odbc/lib. Save that string as LD_LIBRARY_PATH in your ~/.bashrc file:

# ~/.bashrc
export LD_LIBRARY_PATH="/usr/local/lib:/usr/dlc/odbc:/usr/dlc/odbc/lib"

Save your ~/.bashrc file and, from your terminal, run:

# in your terminal
source ~/.bashrc

Your changes to ~/.bashrc are now applied. Nice!


3. ODBC File Configuration

ODBC File Configuration depends on whether you create a Data Source Name (DSN) or use an instanced ODBC configuration for your drivers.

To be more efficient (and because I couldn’t understand Progress’s instanced ODBC docs), we can use a Data Source Name (DSN) in our /etc/odbc.ini to hold some of these variables for us.

3a. Data Source Name Configuration

Open your /etc/odbc.ini file and append the below configuration. Note that you will need to supply variables where I have put YOUR_* placeholders.

# /etc/odbc.ini
[ODBC Data Sources]
ProgressOpenEdge=DataDirect 7.1 Progress OpenEdge Wire Protocol

[ProgressOpenEdge]
Driver=/usr/dlc/odbc/lib/pgoe27.so
Description=DataDirect 7.1 Progress OpenEdge Wire Protocol
AllowedOpenSSLVersions=1.1.1,1.0.2
AlternateServers=
ArraySize=
ConnectionRetryCount=0
ConnectionRetryDelay=3
CryptoLibName=
CryptoProtocolVersion=TLSv1.2, TLSv1.1, TLSv1,SSLv3
Database=YOUR_DATABASE
DefaultIsolationLevel=1
EnableTimestampWithTimezone=1
Encryption Method=0
FailoverGranularity=0
FailoverMode=0
FailoverPreconnect=0
HostName=YOUR_HOSTNAME
HostNameInCertificate=
KeepAlive=0
LoadBalancing=0
LoginTimeout=15
PortNumber=YOUR_PORT_NUMBER
QueryTimeout=0
SSLLibName=
TrustStore=
TrustStorePassword=
UseWideCharacterTypes=0
ValidateServerCertificate=1

[ODBC File DSN]
DefaultDSNDir=

[ODBC]
IANAAppCodePage=4
InstallDir=/usr/dlc/odbc/
Trace=0
TraceFile=odbctrace.out
TraceDll=/usr/dlc/odbc/lib/pgoe27.so
ODBCTraceMaxFileSize=102400
ODBCTraceMaxNumFiles=10

The fields Database, HostName, and PortNumber will be based on your Progress database’s configuration. You may also need to adjust other variables depending on other database factors. The above is what worked for me.

Here are the following fields I amended:

  • Under [ODBC Data Sources]
  • Added ProgressOpenEdge=DataDirect 7.1 Progress OpenEdge Wire Protocol based on Progress’s example odbc.ini
  • Under [Progress OpenEdge]
  • Amended Driver to /usr/dlc/odbc/lib/pgoe27.so (our installation file from Step 1).
  • Amended the fields Database, HostName, and PortNumber to placeholders you will change.
  • Under [ODBC]
  • Amended InstallDir to /usr/dlc/odbc/ (our parent installation directory from Step 1 - see Progress’s Configuring Through The System Information (odbc.ini) File
  • Amended TraceDll to /usr/dlc/odbc/lib/pgoe27.so (our installation file from Step 1).
  • NOTE. I lucked out on IANAAppCodePage=4 (the default). There’s a IANAAppCodePages mapping table on Progress’s site, but I couldn’t easily deduce the code page of my database. Fortunately, my friends at Zedfox added their code page of their Progress database in their “Testing OpenEdge ODBC connection” section, on line 12 of their Test.php script. Thanks fellas!

You’re successfully altered the Data Source Name (DSN) configuration. Nice! Skip to Step 4.


4. Testing the Connection

Navigate to your main Python directory and boot up a Python shell. For me, I use:

# in your terminal
pipenv run python

Run the following Python commands in that shell:

# in a python shell
import os
os.getenv("ODBCINI")         # If you don't get /etc/odbc.ini, go back to Step 2
os.getenv("ODBCINST")        # If you don't get /etc/odbcisnt.ini, go back to Step 2
os.getenv("LD_LIBRARY_PATH") # If you don't get <INITIAL LD_LIBRARY_PATH value>:/usr/dlc/odbc:/usr/dlc/odbc/lib, go back to Step 2

import pyodbc
pyodbc.dataSources()
{'ProgressOpenEdge': '/usr/dlc/odbc/lib/pgoe27.so', ...} 
# If you don't see 'ProgressOpenEdge' mapping to
# '/usr/dlc/odbc/lib/pgoe27.so', return to Step 3a/b and double-check your configuration settings.

pyodbc.connect("DSN=ProgressOpenEdge;uid=YOUR_USERNAME;pwd=YOUR_PASSWORD")

You should be greeted with a <pyodbc.Connection object>. If you are, you have successfully installed the Progress OpenEdge 12.0 Driver on CentOS! Nice!