Zend_db on iSeries - can't find database

Posted on 2009-04-21
Last Modified: 2012-05-06
Trying to use Zend_db on our iseries(as400) server. When running this simple test code. I get this error:
Getting connection...
Relational database J3000 not in relational database directory. SQLCODE=-950

I have been using Zend in may applications on this server but not a lot of the framework. I have many php applications that query this database successfully using db2_exec() and the other db2 functions built into php.

I can't figure out why Zend_db gripes when trying to connect to this or any other database on this server.
require_once ("Zend/Db.php");

try {

$params = array (

'host' => 'localhost',

'username' => 'username',

'password' => 'password',

'dbname' => 'J3000'


$db = Zend_Db::factory ( 'Db2', $params );

echo "Getting connection...<br />\n";


echo "Closing connection...<br />\n";


} catch ( Zend_Db_Adapter_Exception $e ) {

echo get_class ( $e ) . "<br />\n";

echo $e->getMessage() . "<br/>\n";

} catch ( Zend_Exception $e ) {

echo get_class ( $e ) . "<br />\n";

echo $e->getMessage() . "<br />\n";


Open in new window

Question by:mhopkins9901
    1 Comment

    Accepted Solution

    Posted to soon. I figured it out. On and as400 you have to use WRKRDBDIRE to make sure you are working with a RDB that is actually in the Relational Database Directory for this to work.

    Changed conncetion params to
    $params = array (
    'host' => 'localhost',
    'username' => 'nobody', //or what ever user the web server runs under
    'password' => '',
    'dbname' => 'XXXXXXX' //the entry that is in the RDB directory.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Creating and Managing Databases with phpMyAdmin in cPanel.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now