?
Solved

Zend_db on iSeries - can't find database

Posted on 2009-04-21
1
Medium Priority
?
971 Views
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...
Zend_Db_Adapter_Db2_Exception
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";
$db->getConnection();
 
echo "Closing connection...<br />\n";
$db->closeConnection();
 
} 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

0
Comment
Question by:mhopkins9901
1 Comment
 

Accepted Solution

by:
mhopkins9901 earned 0 total points
ID: 24195657
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.
);
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

839 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