简体   繁体   中英

How to specify database of OCI_CONNECT

Goog afternoon.

I'm trying to implement a conection with Oracle Database from PHP. But i'm not getting success.

$conn_oracle = oci_connect('username', 'password', '10.1.11.7');

Please, witch the order of parameters?

Check "Oracle Database Name Connection Identifiers" on page 104 of the free The Underground PHP and Oracle Manual PDF.

Commonly you probably need just the service name of the database that is running on your computer. If that name was XEPDB1 , then your PHP code would then use

$conn_oracle = oci_connect('username', 'password', '10.1.11.7/XEPDB1');

If the database service is running on a non-default port, you might to include that:

$conn_oracle = oci_connect('username', 'password', '10.1.11.7:1522/XEPDB1');

(The default port is 1521).

Typically to find a service name you could (i) ask someone else using the DB (ii) look at other connection strings you use in other tools (iii) ask the DBA (iv) log into a terminal where the DB is running, set the Oracle environment (on Linux etc with source /usr/local/bin/oraenv ), and then run lsnrctl status (v) trying common names: XEPDB1 , orclpdb , or orclpdb1 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM