PHP 7.4.8 Released!


(PHP 4, PHP 5)

sybase_select_dbSeleciona um banco de dados Sybase


sybase_select_db ( string $database_name [, resource $link_identifier ] ) : bool

sybase_select_db() define o banco de dados ativo que é associado ao identificador de conexão especificado. Se não for especificado um identificador de conexão, a última conexão aberta é assumida. Se não houver conexão aberta, a função tentará establecer uma conexão como se sybase_connect() fosse utilizada, e irá usa-la.

Retorna TRUE em caso de sucesso ou FALSE em caso de falha.

Todas as próximas chamadas a sybase_query() serão feitas no banco de dados ativo.

Veja também sybase_connect(), sybase_pconnect() e sybase_query()

add a note add a note

User Contributed Notes 1 note

verdy_p at wanadoo dot fr
20 years ago
Using this function is not required under Sybase, because Sybase SQL Server users can be configured with a default database to use at connection time. You only need this function if your SQL Server has multiple database names, and you want to switch your queries from one database to another one on the same SQLServer, for example if the connection user name has "master" as its default database name and you want to process queries in your application database, or if the username (in fact the loginname in Sybase terminology) has an application database configured for its default database, and you want to process some queries in the "master", "tempdb", or "sybsystemprocs" database.
When you call this function, and it returns successfully, the "username" parameter in the sybase_connect or sybase_pconnect function calls is NOT the user name that holds the access rights in that database. In fact, the "username" is used by Sybase only as a loginname for the SQL Server, and it is mapped to a database-specific username according to the contents of the database sysusers system table that maps logins to database users. Many databases only have a "dbo" username, whatever the loginname you configured on the server's "master" database; in that case to the database is specified by the default servername for the specified loginname, and the access rights are determined by the database's map in sysusers system table which specifies with login is associated with the "dbo" user. You may elect to configure another user in your application database, with limited granted rights, and then add a new server login with a specific password and this database as its default database to use. Such a configuration will add an extra level of security for your database, avoiding full privileges (thus forbidding alteration of the database schema by PHP3 scripts). You may also give strict grants with select-only access rights to the new user, so that PHP3 will only be able to select data from the database, but won't be granted to modify the database contents.
To Top