Doctrine DBAL module for DB2 on the IBM i platform, while using odbc drivers on linux

0.1.6 2019-12-13 23:16 UTC

This package is auto-updated.

Last update: 2021-11-17 22:09:49 UTC


I needed a solution to use Doctrine within an Zend-Expressive application, while moving the app onto a Linux server and keep using DB2 on the IBMi and all I had was ODBC.

  • Keep using Doctrine
  • Don't spend a fortune on IBM's Connect licenses
  • Utilize ODBC



For your Linux server you will need the IBM i Access Client Solutions. A good guide can be found here ->



$ composer require guidofaecke/doctrine-dbal-ibmi-linux


For Doctrine itself, just follow these instructions ->

In your connection configuration, for example config/autoload/doctrine.local.php use this specific DB2IBMiLinuxDriver class:


return [
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'driverClass' => \DoctrineDbalIbmiLinux\Driver\DB2IBMiLinuxDriver::class,
                'params' => [
                    'host'       => 'my_host',
                    'user'       => 'my_user',
                    'password'   => 'my_password',
                    'dbname'     => 'my_db', <-- can be found via DSPRDBDIRE or ask your admin
                    'persistent' => true,
                    'naming'     => 1, <-- 1=system naming, 0=sql naming

The naming parameter essentially dictates if you use the library list defined in the JOBD for the user (naming = 1) or you have to provide the library name for every table/entity (naming = 0).

Known problems

I don't deliver this package with a working unit-test. Use it at your own risk.