resource wb_pconnect( string server [, string application [, string user [, string password] ] ] )
- Name of the server that is being accessed. Required parameter.
- Name of the application you are working with. If not specified, no application will be used.
- Name of the user you are connecting as. If not specified or empty, you will login as the Anonymous user.
- Password for the specified user. If not specified, an empty password will be used.
This function creates a persistent connection to the SQL Server.
This has similar functionality to the wb_connect function, except for the following differences:
- First, the function tries to find a persistent connection that was opened by a previous call to the same function with the same parameters (database name, application, user and password). If such a connection exists and is not being used by someone else (by a running PHP script), it will be returned and a new connection will not be established.
- The connection to the SQL Server will not close by calling the wb_close function or when the PHP script terminates. The connection will remain open for future use.
The number of simultaneous open persistent database connections can be set using the following parameters in the PHP.INI file:
wb_max_persistent - Maximum allowed number of persistent connections, or -1 (unlimited). The connections are counted for all databases (SQL Servers) together
wb_allow_persistent - 0 (persistent connections disabled), or 1 (enabled)
The connection count must be lower than the value in the wb_max_links parameter (see wb_connect function description).
The default value of the parameter wb_max_persistent is -1 and wb_allow_persistent is 1. Persistent connections are enabled and the number of simultaneously persistent connections is not limited.
A more detailed description of database connection may be found in the PHP documentation in the Persistent Database Connections chapter.
Identifier of the open connection if successful, otherwise FALSE. The return value (if successful) can be used as a parameter for the wb_exec function and other functions that require an open connection.