Seiden Group
Modern Development & Open Source for IBM i
  • Link to LinkedIn
  • Link to Mail
  • Home
  • Seiden PHP+
    • Seiden PHP+
    • Install & Learn
    • SmartSupport
    • PHP Migrations & Upgrades
    • Success Stories
    • Free PHP Assessment
    • Documentation
    • What’s New (Changelog)
  • IBM i Services
    • Development
    • Training & Mentoring
    • Open Source Setup & Upgrades
    • SSL/TLS Install & Learn
    • Performance
  • Support
    • Open Source & PHP
    • VS Code for i
    • Developer Support
    • Support Success Stories
  • VS Code for i
    • Support
    • Training
    • Code for i Resource Guide
    • Getting Started Videos
    • Code for IBM i Fridays
  • Free Stuff
    • IBM i Strategy & Tips
    • PHP Upgrade Assessment
    • CNX Valence Assessment
    • VS Code for IBM i Resources
    • Code for IBM i Fridays
    • QCachegrind Download
    • PHP Toolkit for IBM i Resources
    • Qshell on i Library
  • Blog
  • About
    • About Our Team
    • About Alan Seiden
    • Speakers & Sessions
    • In the News
  • Contact
  • 201.447.2437
  • Search
  • Menu Menu

Seiden Group Blog

Running the x86 IBM i ODBC driver on ARM Linux with Rosetta

May 30, 2023/0 Comments/in ODBC, Open Source /by Calvin Buckley

ODBC with Db2 for IBM iI recently did some research on how to run the IBM i ODBC driver under Linux on newer macOS architecture and thought I’d share what I learned.

Over the last few years, macOS has changed from x86 (Intel) to ARM architecture. IBM has kept pace by updating its IBM i ODBC driver to support ARM on macOS as of version 1.1.0.15.

Developers who use a Linux virtual machine, however, will note that there is no ARM version of the Linux driver available yet. While an ARM-native version of the driver would be ideal, Mac users running a Linux virtual machine can run the existing x86 version of the driver using Rosetta for Linux.

Prerequisites

Note that you’ll need to run some commands with root privilege; use sudo or log in as root, depending on how your system is set up.

Linux: What’s multiarch?

A multiarch Linux distribution lets you install packages for other architectures. This way, we can have both the ARM and x86 versions of libraries installed. You’ll need this multiarch distribution to run any complex Linux program that depends on x86 shared libraries on an ARM distro. Whole programs can usually be installed, too, but their architecture versions tend to be mutually exclusive.

Note that some distros offer only limited multiarch, if at all. For example, Red Hat–based distributions usually only let you install the 32-bit and 64-bit versions of one type of architecture. In this article, we’ll be using Debian, because Debian (and Ubuntu) have full multi-arch setups.

Setting up Rosetta

Rosetta emulates an x86 environment on newer ARM Macs. The following instructions assume you will set up Rosetta using the open source UTM virtual machine host for Mac with an Apple Virtualization VM. Other virtualization or container software might support Rosetta, but we won’t cover setting up those in this article. Please follow the Rosetta installation instructions in the UTM documentation.

Setting up multiarch (Debian/Ubuntu)

At first, our ARM installation of Debian won’t recognize x86 packages. Let’s add support for 64-bit x86 architecture, also known as amd64:

1
dpkg --add-architecture amd64

We’ll need to update the package cache for apt to become aware of this change.

1
apt-get update

Now, we can install x86 packages.

Install the driver (Debian/Ubuntu)

First, install the driver’s dependencies. We’ll install the x86 version of unixODBC:

1
apt install unixodbc:amd64 odbcinst:amd64

Now, we’ll install the driver (filename depending on the version), obtained as described in this blog post by IBM engineer Kevin Adler (Note you want the amd64 version.):

1
dpkg -i ibm-iaccess-1.1.0.27-1.0.amd64.deb

Testing

Because we installed an x86 version of unixODBC, including the isql utility, we can actually test right here. We’ll use the -k flag to pass in a full connection string (though you certainly can use a DSN when set up):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$ uname -a # prove it's arm linux
Linux utmdeb 5.10.0-21-arm64 #1 SMP Debian 5.10.162-1 (2023-01-21) aarch64 GNU/Linux
$ file `which isql` # prove that it's x86 unixODBC
/usr/bin/isql: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=8b19e49f797f20022510a8076e6c229ca08c2c6d, for GNU/Linux 3.2.0, stripped
$ isql -v -k "Driver=IBM i Access ODBC Driver;System=hostname;XDYNAMIC=0;UID=user;PWD=password"
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> select * from qiws.qcustcdt
+---------+-----------------+-------+---------------------------+-------------+------+--------+-------+-------+---------+---------+
| CUSNUM  | LSTNAM          | INIT  | STREET                    | CITY        | STATE| ZIPCOD | CDTLMT| CHGCOD| BALDUE  | CDTDUE  |
+---------+-----------------+-------+---------------------------+-------------+------+--------+-------+-------+---------+---------+
| 938472  | Henning         | G K   | 4859 Elm Ave              | Dallas      | TX   | 75217  | 5000  | 3     | 37.00   | 0       |
| 839283  | Jones           | B D   | 21B NW 135 St             | Clay        | NY   | 13041  | 400   | 1     | 100.00  | 0       |
| 392859  | Vine            | S S   | PO Box 79                 | Broton      | VT   | 5046   | 700   | 1     | 439.00  | 0       |
| 938485  | Johnson         | J A   | 3 Alpine Way              | Helen       | GA   | 30545  | 9999  | 2     | 3987.50 | 33.50   |
| 397267  | Tyron           | W E   | 13 Myrtle Dr              | Hector      | NY   | 14841  | 1000  | 1     | 0       | 0       |
| 389572  | Stevens         | K L   | 208 Snow Pass             | Denver      | CO   | 80226  | 400   | 1     | 58.75   | 1.50    |
| 846283  | Alison          | J S   | 787 Lake Dr               | Isle        | MN   | 56342  | 5000  | 3     | 10.00   | 0       |
| 475938  | Doe             | J W   | 59 Archer Rd              | Sutter      | CA   | 95685  | 700   | 2     | 250.00  | 100.00  |
| 693829  | Thomas          | A N   | 3 Dove Circle             | Casper      | WY   | 82609  | 9999  | 2     | 0       | 0       |
| 593029  | Williams        | E D   | 485 SE 2 Ave              | Dallas      | TX   | 75218  | 200   | 1     | 25.00   | 0       |
| 192837  | Lee             | F L   | 5963 Oak St               | Hector      | NY   | 14841  | 700   | 2     | 489.50  | .50     |
| 583990  | Abrams          | M T   | 392 Mill St               | Isle        | MN   | 56342  | 9999  | 3     | 500.00  | 0       |
+---------+-----------------+-------+---------------------------+-------------+------+--------+-------+-------+---------+---------+

Install an x86 PHP (Debian/Ubuntu)

Because the ODBC driver is x86, PHP needs to be x86 as well.

The PHP provided in Debian 11 does not properly support multiarch, so we recommend Ondřej Surý’s repository, which also provides newer PHP than Debian or Ubuntu. First, follow Surý’s instructions for the Ubuntu PPA or DPA Debian repository, as appropriate, then install PHP:

1
apt-get install php8.2-cli:amd64 php8.2-odbc:amd64

With a test script…

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
 
$pdo = new PDO("odbc:Driver=IBM i Access ODBC Driver;System=hostname", "username", "password", [\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_NUM]);
$stmt = $pdo->query("select * from qiws.qcustcdt");
$rows = $stmt->fetchAll();
 
foreach ($rows as $row) {
for ($i = 0; $i < count($row); $i++) {
echo $row[$i];
if ($i + 1 != count($row)) echo "\t";
}
echo "\n";
}

…we can actually try using x86 PHP:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ uname -a # prove it's arm linux
Linux utmdeb 5.10.0-21-arm64 #1 SMP Debian 5.10.162-1 (2023-01-21) aarch64 GNU/Linux
$ file `which php8.2` # prove it's x86 php
/usr/bin/php8.2: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a0385ef0a7641ba5623ea5f14c23efaacb07ae63, for GNU/Linux 3.2.0, stripped
$ php8.2 test.php
938472 Henning G K 4859 Elm Ave Dallas TX 75217 5000 3 37.00 0
839283 Jones   B D 21B NW 135 St Clay   NY 13041 400 1 100.00 0
392859 Vine     S S PO Box 79     Broton VT 5046 700 1 439.00 0
938485 Johnson J A 3 Alpine Way Helen GA 30545 9999 2 3987.50 33.50
397267 Tyron   W E 13 Myrtle Dr Hector NY 14841 1000 1 0 0
389572 Stevens K L 208 Snow Pass Denver CO 80226 400 1 58.75 1.50
846283 Alison   J S 787 Lake Dr   Isle   MN 56342 5000 3 10.00 0
475938 Doe     J W 59 Archer Rd Sutter CA 95685 700 2 250.00 100.00
693829 Thomas   A N 3 Dove Circle Casper WY 82609 9999 2 0 0
593029 Williams E D 485 SE 2 Ave Dallas TX 75218 200 1 25.00 0
192837 Lee     F L 5963 Oak St   Hector NY 14841 700 2 489.50 .50
583990 Abrams   M T 392 Mill St   Isle   MN 56342 9999 3 500.00 0

Using it with Node (Debian)

Using the ODBC driver with node is straightforward because there is a prebuilt x86 version of the ODBC package for Node. Just npm install odbc and make sure you use an x86 version of Node. It’ll pull in a prebuilt version of the Node ODBC package, so there’s no need to install compilers. To install the version of Node from Debian, run this command:

1
apt install nodejs:amd64

To install from Node upstream, use the x86 version instead of the ARM one.

Tags: Linux
Share this entry
  • Share on Facebook
  • Share on X
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Reddit
  • Share by Mail
https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png 0 0 Calvin Buckley https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png Calvin Buckley2023-05-30 17:35:002023-06-26 17:45:19Running the x86 IBM i ODBC driver on ARM Linux with Rosetta
Calvin Buckley

About Calvin Buckley

Recognized as an IBM Champion and a 2020 Fresh Face of IBM i, Calvin exhibits remarkable talent for expanding the use of IBM i through open ...Read More

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

SUBSCRIBE
Open Thinking
Monthly IBM i Strategy & Tips
  • This field is for validation purposes and should be left unchanged.

IBM i Development

  • RPG, COBOL, SQL, Node,
    PHP, Python, Valance, etc.
  • Modernization. Integration.
  • Web and API Solutions
  • Legacy Maintenance
    ...
LET'S GET IT DONE!

Recent Posts

  • Moving to IBM i 7.6? An SDA Alternative with VS Code and IBM Bob
  • What’s New with Mapepire Database Connector for IBM i
  • Do You Need IBM i Observability?
  • PHP 8.6 is Coming Soon to IBM i
  • Safer npm installation is on the way for Node.js (and all JavaScript)
  • Access Modern Security for IBM i and Connected Web Environments
  • IBM i: A Natural Platform for Agentic AI
  • PHP on IBM i in 2026: The Modernization Engine
  • Your “AS/400” Is a Modern IBM i Platform
  • MCP + AI for IBM i Teams (with a MongoDB example)

SEIDEN GROUP: Modern Development & Open Source for IBM i

Home   |   Seiden PHP+   |   IBM i Services  |   Support   |   VS Code for i   |   Free Stuff   |   Blog  |   Privacy Policy  |   Contact         201.447.2437

© 2026 Seiden Group, LLC
  • Link to LinkedIn
  • Link to Mail
Link to: Basic Authentication Credentials are Encrypted with TLS Link to: Basic Authentication Credentials are Encrypted with TLS Basic Authentication Credentials are Encrypted with TLS Link to: Common Europe Congress 2023 in Prague Link to: Common Europe Congress 2023 in Prague Common Europe Congress 2023 in Prague
Scroll to top Scroll to top Scroll to top