PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #7226

Using the oci8 with instant client couldn't connect

Details

Request #7226Using the oci8 with instant client couldn't connect
Submitted2006-03-28 13:48 UTC
Fromtom at greenleaftech dot net
StatusDuplicate
PackageDB
PHP Version5.1.2
OSLinux (Ubuntu and FC3)
Roadmaps(Not assigned)

Comments

[2006-03-28 13:48 UTC] tom at greenleaftech dot net

Description:
------------
I'm using the Oracle Instant Client, which allows you to connect without having a TNS Names installed - all you have to do is specify the SID along with the other parameters. I was able to connect using the oci8 with the following connect string:

$conn = OCILogon($oracledb['user'], $oracledb['pass'], "//".$oracledb['host'].":".$oracledb['port']."/".$oracledb['sid']);

However, I wasn't able to connect using PEAR's oci module, so I made the following change to the connect function of DB/oci8.php

Here's the comment to my config file, which explains the details.

// This has required a custom hack of the PEAR DB class
// To this file <PEAR PATH>/DB/oci8.php
/*************************************************************
* Differences as below (added the line with a plus on it)
// Backwards compatibility with DB < 1.7.0
if (empty($dsn['database']) && !empty($dsn['hostspec'])) {
$db = $dsn['hostspec'];
} else {
$db = $dsn['database'];
+ $db = "//".$dsn['hostspec'].":".$dsn['port']."/".$dsn['database'];
}
**************************************************************/