PHP code example of pan-roman / ifx4dd-plus

1. Go to this page and download the library: Download pan-roman/ifx4dd-plus 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/ */

    

pan-roman / ifx4dd-plus example snippets


    

    $dsn = 'informix:'
        . 'host=hosttest1;'
        . 'server=test1tcp;'
        . 'database=test_database;'
        . 'protocol=onsoctcp;'
        . 'service=50000;';

    $user = 'your_user';
    $password = 'your_password';

    $con = new PDO($dsn, $user, $password);

    if ($con) {
      echo "The connection was successfully established\n";
    }

    

    // Gets the autoloader
    $classLoader =     // Doctrine\DBAL namespace
    $classLoader->add(
        'Doctrine\\DBAL\\',
        'vendor/josemalonsom/ifx4dd/lib',
        true
    );

    use Doctrine\DBAL\DriverManager;

    $connectionParams = array(
        'driver'       => 'pdo_informix',
        'host'         => 'hosttest1',
        'port'         => '50000',
        'protocol'     => 'onsoctcp',
        'server'       => 'test1tcp',
        'dbname'       => 'test_database',
        'user'         => 'user',
        'password'     => 'password',
        'db_locale'     => 'ru_RU.1251', // optional
        'client_locale'     => 'ru_RU.1251', // optional
    );

    $connection = DriverManager::getConnection($connectionParams);

    

    ine\DBAL\DriverManager;

    $connectionParams = array(
        'driverClass'  => '\Doctrine\DBAL\Driver\PDOInformix\Driver',
        'host'         => 'hosttest1',
        'port'         => '50000',
        'protocol'     => 'onsoctcp',
        'server'       => 'test1tcp',
        'dbname'       => 'test_database',
        'user'         => 'user',
        'password'     => 'password',
        'db_locale'     => 'ru_RU.1251', // optional
        'client_locale'     => 'ru_RU.1251', // optional
    );

    $connection = DriverManager::getConnection($connectionParams);

    

    $classLoader =    'Doctrine\\DBAL\\',
        'vendor/josemalonsom/ifx4dd/lib',
        true
    );

    use Doctrine\DBAL\DriverManager;

    $connection = DriverManager::getConnection(array(
        'url' => 'informix://user:password@hosttest1:50000/test_database?protocol=onsoctcp&server=test1tcp'
    ));