Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dbx_connect(3) [php man page]

DBX_CONNECT(3)								 1							    DBX_CONNECT(3)

dbx_connect - Open a connection/database

SYNOPSIS
object dbx_connect (mixed $module, string $host, string $database, string $username, string $password, [int $persistent]) DESCRIPTION
Opens a connection to a database. PARAMETERS
o $module - The $module parameter can be either a string or a constant, though the latter form is preferred. The possible values are given below, but keep in mind that they only work if the module is actually loaded. o DBX_MYSQL or "mysql" o DBX_ODBC or "odbc" o DBX_PGSQL or "pgsql" o DBX_MSSQL or "mssql" o DBX_FBSQL or "fbsql" o DBX_SYBASECT or "sybase_ct" o DBX_OCI8 or "oci8" o DBX_SQLITE or "sqlite" o $host - The SQL server host o $database - The database name o $username - The username o $password - The password o $persistent - The $persistent parameter can be set to DBX_PERSISTENT, if so, a persistent connection will be created. The $host, $database, $username and $password parameters are expected, but not always used depending on the connect functions for the abstracted module. RETURN VALUES
Returns an object on success, FALSE on error. If a connection has been made but the database could not be selected, the connection is closed and FALSE is returned. The returned $object has three properties: o database - It is the name of the currently selected database. o handle - It is a valid handle for the connected database, and as such it can be used in module-specific functions (if required). <?php $link = dbx_connect(DBX_MYSQL, "localhost", "db", "username", "password"); mysql_close($link->handle); // dbx_close($link) would be better here ?> o module - It is used internally by dbx only, and is actually the module number mentioned above. CHANGELOG
+--------+---------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------+ | 5.0.0 | | | | | | | Introduced DBX_SQLITE. | | | | | 4.3.0 | | | | | | | Introduced DBX_OCI8. | | | | | 4.2.0 | | | | | | | Introduced DBX_SYBASECT. | | | | | 4.1.0 | | | | | | | Introduced DBX_FBSQL. | | | | +--------+---------------------------+ EXAMPLES
Example #1 dbx_connect(3) example <?php $link = dbx_connect(DBX_ODBC, "", "db", "username", "password", DBX_PERSISTENT) or die("Could not connect"); echo "Connected successfully"; dbx_close($link); ?> NOTES
Note Always refer to the module-specific documentation as well. SEE ALSO
dbx_close(3). PHP Documentation Group DBX_CONNECT(3)

Check Out this Related Man Page

OCI_PASSWORD_CHANGE(3)													    OCI_PASSWORD_CHANGE(3)

oci_password_change - Changes password of Oracle's user

SYNOPSIS
bool oci_password_change (resource $connection, string $username, string $old_password, string $new_password) DESCRIPTION
resource oci_password_change (string $dbname, string $username, string $old_password, string $new_password) Changes password for user with $username. The oci_password_change(3) function is most useful for PHP command-line scripts, or when non-persistent connections are used throughout the PHP application. PARAMETERS
o $connection - An Oracle connection identifier, returned by oci_connect(3) or oci_pconnect(3). o $username - The Oracle user name. o $old_password - The old password. o $new_password - The new password to be set. o $dbname - The database name. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 oci_password_change(3) example changing the password of an already connected user <?php $dbase = 'localhost/orcl'; $user = 'cj'; $current_pw = 'welcome'; $new_pw = 'geelong'; $c = oci_pconnect($user, $current_pw, $dbase); oci_password_change($c, $user, $current_pw, $new_pw); echo "New password is : " . $new_pw . " "; ?> Example #2 oci_password_change(3) example of connecting and changing the password in one step <?php $dbase = 'localhost/orcl'; $user = 'cj'; $current_pw = 'welcome'; $new_pw = 'geelong'; $c = oci_pconnect($user, $current_pw, $dbase); if (!$c) { $m = oci_error(); if ($m['code'] == 28001) { // "ORA-28001: the password has expired" // Login and reset password at the same time $c = oci_password_change($dbase, $user, $current_pw, $new_pw); if ($c) { echo "New password is : " . $new_pw . " "; } } } if (!$c) { // The original error wasn't 28001, or the password change failed $m = oci_error(); trigger_error('Could not connect to database: '. $m['message'], E_USER_ERROR); } // Use the connection $c ?> NOTES
Note Changing the password either with this function or directly in Oracle should be done carefully. This is because PHP applications may continue to successfully reuse persistent connections by authenticating with the old password. The best practice is to restart all web servers whenever the user password is changed. Note If upgrading the Oracle client libraries or the database from a release prior to 11.2.0.3 to version 11.2.0.3 or higher, oci_pass- word_change(3) may give the error "ORA-1017: invalid username/password" unless both client and server versions are upgraded at the same time. Note The second oci_password_change(3) syntax is available since OCI8 version 1.1. Note In PHP versions before 5.0.0 you must use ocipasswordchange(3) instead. This name still can be used, it was left as alias of oci_password_change(3) for downwards compatability. This, however, is deprecated and not recommended. PHP Documentation Group OCI_PASSWORD_CHANGE(3)
Man Page