this is what i do for zend to connect to oracle and it works perfectly
in the Zend Library in the Zend\Db directory i have made a file called Dbname.php
<?php
date_default_timezone_set("Europe/London");
require_once 'Zend/Registry.php';
/**
* Class for creeating an Oracle SQL Dbname.
*
* @Author Chris Robinson cghrmauritius@gmail.com
*/
class Zend_Db_Dbname
{
public static function get($arr) {
$enviroment = Zend_Registry::get("enviroment");
if(isset($arr[$enviroment.":db"])){
$retArray = $arr[$enviroment.":db"];
$dbName = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST={$retArray['host']})(PORT={$retArray['port']})))";
$dbName .= "(CONNECT_DATA=";
if(isset($retArray['pooled'])){
if($retArray['pooled'] == 1)
$dbName .= "(SERVER = POOLED)";
}
if(isset($retArray['sid'])){
$dbName .= "(SID={$retArray['sid']})))";
}else if(isset($retArray['serviceName'])){
$dbName .= "(SERVICE_NAME={$retArray['serviceName']})))";
}
$retArray['dbname'] = $dbName;
unset($retArray['pooled']);
return $retArray;
}
return "Missing '".$this->enviroment.":db' from application.ini";
}
}
?>
also i have an ini file ('myfilename.ini') which holds all the db connection details for our dev and production dbs which is as follows
[global]
salt = "qZPJeZbQv])7fnKxS’U0\2V^Eg.|})+obZ:H6|y.[#EBqo;Evp"
api = "d5f75f4ddc0a5cead40b4269ca28b217b71ed893";
[production]
debug = false
[production:db]
host = xx.xx.xx.xxx
username = myusername
password = mypassword
port = xxxx
charset = "WE8ISO8859P1"
pooled = true
sid = mysid
[development]
debug = true
[development:db]
host = xx.xx.xx.xxx
username = myusername
password = mypassword
port = xxxx
charset = "WE8ISO8859P1"
pooled = false
sid = mysid
debug = true
then in my website code or class which is to make the connection
Zend_Registry::set("enviroment", "production");
$arr = parse_ini_file('myfilename.ini',true);
$options = Zend_Db_Dbname::get($arr);
$db = Zend_Db::factory('Oracle', $options);
Using this method i find extremely useful and quick to create new classes / pages / apis ect and allows to very quickly switch between development and production servers.
If you need any further help just ask away.