How can I connect to HFSQL C/S using python on Linux?

1 week ago 12
ARTICLE AD BOX

I am trying to connect to a legacy HFSQL (HyperFileSQL) Client/Server database using Python (pyodbc) on a Linux Ubuntu machine.

I have followed the official documentation to install the specific ODBC driver for Linux, but I keep getting an IM002 error indicating a disconnect between the Driver Manager and the configuration files.

System Setup:

OS: Ubuntu 20.04 (approx) Driver: HFSQL ODBC Linux 64-bit (via install.sh) ODBC Manager: libiodbc2 libiodbc2-dev Python Package: pyodbc

Configuration Steps Taken:

I installed the dependencies required by WinDev: sudo apt-get install libiodbc2 libiodbc2-dev I installed the driver successfully. I verified the entry in /etc/odbcinst.ini: [ODBC Drivers] HFSQL = Installed [HFSQL] Description = HFSQL ODBC Driver Driver = /home/datpandx/hfsql/wd250hfo64.so I configured a User DSN in ~/.odbc.ini: [ODBC Data Sources] HFSQL_FRUTAL = HFSQL [HFSQL_FRUTAL] Driver = HFSQL Server Name = 26.*** Server Port = 4900 Database = *** UID = *** PWD = ***

Diagnostics: Running pyodbc.drivers() correctly lists 'HFSQL', which suggests Python can read the odbcinst.ini file. However, when inspecting the driver binary dependencies with ldd, I see it links to libiodbc, while pyodbc typically relies on unixODBC.

The Problem: When I try to connect using a DSN-less connection string (to rule out .ini file path issues), it fails immediately.

Code:

import pyodbc print(f"Available Drivers: {pyodbc.drivers()}") # Output: ['ODBC Drivers', 'HFSQL'] user = '***' password = '***' try: conn_str = ( f"DSN={driver_name};" f"UID={user};" f"PWD={password};" ) print(f"Trying to connect to: {driver_name} ...") conn = pyodbc.connect(conn_str) print("¡CONNECTED!") conn.close() except Exception as e: print("Fail") print(e)

The error:

['ODBC Drivers', 'HFSQL'] Trying to connect to: HFSQL_FRUTAL ... Fail ('HY000', 'The driver did not supply an error!')

What I have tried:

Verified file paths in /etc/odbcinst.ini are absolute and correct. Tried setting environment variables explicitly before running the script: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/datpandx/hfsql Tried using the DSN approach (DSN=HFSQL_FRUTAL) with the same error
result.

Is there a known solution between pyodbc and the HFSQL driver (which appears to depend on iODBC)? How can I bridge this gap on Linux?

Read Entire Article