# fbsql_database_password

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

fbsql_database_password — Sets or retrieves the password for a FrontBase database

### 说明

fbsql_database_password ( resource `$link_identifier` [, string `$database_password` ] ) : string

Sets and retrieves the database password used by the connection. If a database is protected by a database password, the user must call this function before calling fbsql_select_db().

If no link is open, the function will try to establish a link as if fbsql_connect() was called, and use it.

This function does not change the database password in the database nor can it be used to retrieve the database password for a database.

### 参数

`link_identifier`

  由 fbsql_connect() 或 fbsql_pconnect() 返回的 FrontBase 链接标识符.

  如可选并未指定，函数会尝试查找一个到 FrontBase 服务器的开放链接，且如没有找到这样的链接，会尝试通过不带参数调用 fbsql_connect() 来创建一个。

`database_password`

  The database password, as a string. If given, the function sets the database password for the specified link identifier.

### 返回值

Returns the database password associated with the link identifier.

### 范例

Example #1 fbsql_create_clob() example

    <?php
    $link = fbsql_pconnect("localhost", "_SYSTEM", "secret")
        or die("Could not connect");
    fbsql_database_password($link, "secret db password");
    fbsql_select_db($database, $link);
    ?>

### 参见

- fbsql_connect() - Open a connection to a FrontBase Server
- fbsql_pconnect() - Open a persistent connection to a FrontBase Server
- fbsql_select_db() - Select a FrontBase database