I think you're putting the connection string information in the wrong
   place. The hostname, ccsid, etc should all be in the dsn string like in
   the second example here:
   [1]
https://www.php.net/manual/en/ref.pdo-odbc.connection.php
    
     ----- Original message -----
     From: MWHopkins@xxxxxxxxxxxxxxx
     Sent by: "OpenSource" <opensource-bounces@xxxxxxxxxxxxxxxxxx>
     To: OpenSource@xxxxxxxxxxxxxxxxxx
     Cc:
     Subject: [EXTERNAL] [IBMiOSS] PHP PDO dsn help
     Date: Mon, Nov 16, 2020 8:49 AM
      
     I am trying to test a PHP implementation of SimpleSAMLPHP where I use an
     authorization that needs to sql a database on the IBMi. It looks like I
     have most of it set up properly, but my PDO connection fails. This is
     running in an Apache server running on that same IBMi.
     Here are the relevant sections of code where it fails:
     'dsn' => 'odbc:DRIVER={IBM i Access ODBC Driver};',
     'username' => '',
     'password' => '',
     'options' =>
     'HOSTNAME=127.0.0.1;PROTOCOL=TCPIP;CCSID=1208;UID=user;PWD=password',
     try {
     $db = new \PDO($this->dsn . $this->options, $this->username,
     $this->password);
     } catch (\PDOException $e) {
     throw new \Exception('PDPModule:'.$this->authId.': - Failed to connect
     to
     \''.
     $this->dsn.'\': '.$e->getMessage());
     }
     This is the message that I get back when I try to test it:
     SimpleSAML\Error\Error: UNHANDLEDEXCEPTION
     Backtrace:
     1 www/_include.php:17 (SimpleSAML_exception_handler)
     0 [builtin] (N/A)
     Caused by: Exception: PDPModule:PDPauthinstance: - Failed to connect to
     'odbc:DRIVER={IBM i Access ODBC Driver};': could not find driver
     Backtrace:
     5 modules/PDPModule/lib/Auth/Source/PDPAuth.php:101
     (SimpleSAML\Module\PDPModule\Auth\Source\PDPAuth::connect)
     4 modules/PDPModule/lib/Auth/Source/PDPAuth.php:136
     (SimpleSAML\Module\PDPModule\Auth\Source\PDPAuth::login)
     3 modules/core/lib/Auth/UserPassBase.php:317
     (SimpleSAML\Module\core\Auth\UserPassBase::handleLogin)
     2 modules/core/www/loginuserpass.php:84 (require)
     1 lib/SimpleSAML/Module.php:260 (SimpleSAML\Module::process)
     0 www/module.php:10 (N/A)
     I have installed the unixODBC and unixODBC-devel packages using the Open
     Source Package Management tool in ACS. I also downloaded and installed
     the
     latest IBMiAccess_v1r1_PASE_AP rpm using YUM.
     It appears that I am missing something to tell PHP where the driver is.
     I
     have an odbcinst.ini file (in /QOpenSys/etc) that looks like this:
     [IBM i Access ODBC Driver]
     Description=IBM i Access ODBC Driver
     Driver=/QOpenSys/pkgs/lib/libcwbodbc.so
     Threading=0
     DontDLClose=1
     UsageCount=2
     Can anyone point me in the direction of what to set to have it find the
     driver?
     Matt Hopkins
     Project Leader
     PDP Group, Inc.
     10909 McCormick Road
     Hunt Valley, MD 21031
     Office: 410.584.0330
     Fax: 410-584-0336
     Cell: 410.258.8845
     MWHopkins@xxxxxxxxxxxxxxx
     www.pdpgroupinc.com
     Confidentiality Notice: This email message is intended only for the
     individual or entity to which it is addressed. This email may contain
     information that is proprietary or privileged, confidential and exempt
     from disclosure under applicable law. If you are not the intended
     recipient, you are hereby notified that any dissemination, distribution
     or
     copying of this communication is strictly prohibited. If you received
     this
     email by accident, please notify the sender immediately and destroy this
     email and all copies of it.
     Confidentiality Notice: This email message is intended only for the
     individual or entity to which it is addressed. This email may contain
     information that is proprietary or privileged, confidential and exempt
     from disclosure under applicable law. If you are not the intended
     recipient, you are hereby notified that any dissemination, distribution
     or copying of this communication is strictly prohibited. If you received
     this email by accident, please notify the sender immediately and destroy
     this email and all copies of it.
     --
     This is the IBMi Open Source Roundtable (OpenSource) mailing list
     To post a message email: OpenSource@xxxxxxxxxxxxxxxxxx
     To subscribe, unsubscribe, or change list options,
     visit: [2]
https://lists.midrange.com/mailman/listinfo/opensource ;
     or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
     Before posting, please take a moment to review the archives
     at [3]
https://archive.midrange.com/opensource ;.
     Help support midrange.com by shopping at amazon.com with our affiliate
     link: [4]
https://amazon.midrange.com ;
      
    
References
   Visible links
   1. 
https://www.php.net/manual/en/ref.pdo-odbc.connection.php
   2. 
https://lists.midrange.com/mailman/listinfo/opensource
   3. 
https://archive.midrange.com/opensource
   4. 
https://amazon.midrange.com/
As an Amazon Associate we earn from qualifying purchases.