PHP code example of guidofaecke / doctrine-dbal-ibmi

1. Go to this page and download the library: Download guidofaecke/doctrine-dbal-ibmi library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

guidofaecke / doctrine-dbal-ibmi example snippets




return [
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'driverClass' => \DoctrineDbalIbmi\Driver\DB2Driver::class,
                'params' => [
                    'host'     => '...',
                    'user'     => '...',
                    'password' => '...',
                    'dbname'   => '...',
                    'persistent' => true,
                    'driverOptions' => [
                        'i5_naming' => DB2_I5_NAMING_OFF,
                        'i5_commit' => DB2_I5_TXN_NO_COMMIT,
                        'i5_lib' => '...',
                    ],
                ],
            ],
        ],
    ],
];



$configuration = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration([
    __DIR__ . '/../path/to/your/entities/',
], true);

$connection = [
    'driverClass' => \DoctrineDbalIbmi\Driver\DB2Driver::class,
    'host' => '...', // Replace this
    'user' => '...', // Replace this
    'password' => '...', // Replace this
    'dbname' => '...', // Look up value with WRKRDBDIRE
    'persistent' => true,
    'driverOptions' => [
        'i5_lib' => '...', // Replace this
        'i5_naming' => DB2_I5_NAMING_OFF,
        'i5_commit' => DB2_I5_TXN_NO_COMMIT,
    ],
];

$entityManager = \Doctrine\ORM\EntityManager::create($connection, $configuration);