rwhite35 Posted November 20, 2015 Share Posted November 20, 2015 Have a Zend Framework 2.4 connection factory that needs to establish a connection with an AS400 iSeries database. The connection has to be made this way bcuz there are multiple test environment and the factory needs to accommodate each. The method is using Zend\Db\Adapter\Adapter and I pass that class an array of database connection parameters. At issue: Zend\Db\Adapter doesn't accept the relational database (directory) name. I'm assuming that since the driver is PDO_IBM, there would be some expectation of a field for explicitly defining the name for the directory. Here is the method: public function conn($dbs) { $this->adapter = new Adapter(array( 'driver' => $dbs['db']['driver'], 'dbname' => $dbs['db']['dbname'], 'username' => $dbs['db']['username'], 'password' => $dbs['db']['password'], 'hostname' => $dbs['db']['hostname'], 'port' => $dbs['db']['port'], )); var_dump($this->adapter); return $this->adapter; } Adapter is an alias for \Zend\Db\Adapter\AdapterAnd here is the object that gets created. ["driver":protected]=> object(Zend\Db\Adapter\Driver\Pdo\Pdo)#224 (4){ ["connection":protected]=>object(Zend\Db\Adapter\Driver\Pdo\Connection)#225 (6) { ["driver":protected]=> *RECURSION* ["profiler":protected]=> NULL ["driverName":protected]=> string(3)"ibm" ["connectionParameters":protected]=> array(6) { ["driver"]=> string(7) "PDO_IBM" ["dbname"]=> string(7) “<relational_database_name>” ["username"]=> string(3) “<user_name" ["password"]=> string(3) “<password>" ["hostname"]=> string(9) "127.0.0.1" ["port"]=> string(3) "446" } I can instantiate the connection object using and query the database fine with: $conn = new \Zend\Db\Adapter\Adapter( ); // using Pdo=ibm:<relational_database_name> And here is the error Connect Error: SQLSTATE=42705, SQLConnect: -950 Relational database dbname=<rdn>;hos not in relational database directory. Any thought (about this topic) are greatly appreciated. Regards, Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted November 22, 2015 Share Posted November 22, 2015 I see some quote issues, “ and ” versus being " Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.