PDO_OCI DSN

(no version information, might be only in CVS)

PDO_OCI DSN -- Connecting to Oracle databases

说明

The PDO_OCI Data Source Name (DSN) is composed of the following elements:

DSN prefix

The DSN prefix is oci:. If you are connecting to a database defined in tnsnames.ora, append the name of the database to the DSN prefix and your DSN is complete.

dbname (Oracle Instant Client)

The URI for the Oracle Instant Client connection takes the form of dbname=//hostname:port-number/database.

范例

例子 1. PDO_OCI DSN examples

The following examples show a PDO_OCI DSN for connecting to Oracle databases:
oci:mydb
oci:dbname=//localhost:1521/mydb


add a note add a note User Contributed Notes
Helpful User
12-Oct-2006 08:59
If you get the error: TNS: could not resolve service name

Remember that the PDO wants to use the default client, which will only use the tnsnames.ora in %ORACLE_HOME%\network\admin. Check that file and make sure your service is defined in there.

BTW, there is a bug with pdo_oci8 with 9i - don't use it. Make sure you just use pdo_oci.dll.