| ADOdb Library for PHP Manual | ||
|---|---|---|
| Prev | Connect | Next |
Non-persistent connect to data source or server $host, using userid $user and password $password. If the server supports multiple databases, connect to database $database.
Returns true/false depending on connection.
ADO Note: If you are using a Microsoft ADO and not OLEDB, you can set the $database parameter to the OLEDB data provider you are using.
PostgreSQL: An alternative way of connecting to the database is to pass the standard PostgreSQL connection string in the first parameter $host, and the other parameters will be ignored.
For Oracle and Oci8, there are two ways to connect. First is to use the TNS name defined in your local tnsnames.ora (or ONAMES or HOSTNAMES). Place the name in the $database field, and set the $host field to false. Alternatively, set $host to the server, and $database to the database SID, this bypassed tnsnames.ora.
Examples:
#
$oraname in tnsnames.ora/ONAMES/HOSTNAMES
$conn->Connect(false, 'scott', 'tiger', $oraname);
$conn->Connect('server:1521', 'scott', 'tiger', 'ServiceName'); # bypass tnsnames.ora
There are many examples of connecting to a database at php.weblogs.com/ADOdb, and in the testdatabases.inc.php file included in the release.
| Prev | Home | Next |
| ADOConnection | Up | PConnect |