ibm_db2 & ODBC Run Side-by-Side in Seiden PHP+

PHP on IBM iIn the past, PHP on IBM i implementations could not load both the classic database extensions (ibm_db2 / PDO_IBM) and the ODBC extensions (odbc / PDO_ODBC) at the same time. An error such as “ibm_db2 GetDiagRec failed” would result.

In July 2021, we overcame those limitations in Seiden PHP+Now the classic PHP database extensions can run side-by-side with ODBC.

To our knowledge, Seiden PHP+ is the only IBM i PHP that can load all the Db2 extensions at the same time. Therefore, when you install Seiden PHP+, all the Db2 extensions (ibm_db2, PDO_IBM, odbc, and PDO_ODBC) can be enabled by default.

Why is this important?

When IBM i teams want to migrate from the classic extensions to PDO_ODBC, they can now adopt ODBC without affecting existing applications. They can migrate at their own pace by using both connectivity types in the same application. For example, a single PHP script can use ibm_db2 for one query and PDO_ODBC for another.

How do I use this feature if I have an older PHP+ package?

First, update to our current software, especially the latest php-ibm_db2, php-pdo_ibm, and siteadd packages. You can update them through ACS or through the command line like so:

After updating, you can enable all the Db2 extensions using the toggle-db command with the -t both flag. To do so for a specific site, point it to the site’s PHP extension INI directory:

To enable these extensions globally for PHP-CLI and all sites using a global (not custom) configuration:

If you have any questions, don’t hesitate to ask us.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a 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.