note 39933 deleted from function.oci-connect by sixd
| From: | sixd@php.net | Date: | Wed, 09 Dec 2009 22:29:11 +0000 |
| Subject: | note 39933 deleted from function.oci-connect by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163784@lists.php.net to get a copy of this message | ||
Note Submitter: cjbj at hotmail dot com
----
If PHP is linked with Oracle 10g (or later) client libraries, the Easy
Connection syntax can be used to identify which database to connect
to. This can remove the need for a local tnsnames.ora file or complex
connect string. The new syntax can be used to connect to earlier
versions of Oracle.
With Oracle 10g client libraries, the third parameter "db" for
OCILogon can have the syntax:
[//]host[:port][/service_name]
An example is:
$c = OCILogon('scott', 'tiger',
'//mymachine.mydomain/mydbservice');
The pre-10g syntax equivalent is something like:
$c = OCILogon('scott', 'tiger',
'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=mymachine.mydomain) (PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=MYDBSERVICE)))');
The full syntax continues to work with 10g. It allows for more
complex configuration than available with the Easy Connect method.
Oracle documentation and the fine print for Easy Connect is at:
http://download-west.oracle.com/docs/cd/B12037_01/network.101/
b10775/naming.htm#i498306
(note the split URL due to PHP doc site limitations needs to be recombined for use)