note 39933 modified in function.ocilogon by sixd
| From: | sixd@php.net | Date: | Mon, 05 Oct 2009 01:37:29 +0000 |
| Subject: | note 39933 modified in function.ocilogon by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161296@lists.php.net to get a copy of this message | ||
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)
--was--
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)
http://php.net/manual/en/function.ocilogon.php