602SQL Documentation Index  

wb_pconnect

PHP

resource wb_pconnect( string server [, string application [, string user [, string password] ] ] )


Parametry

server
Name of the server that is being accessed. Required parameter.
application
Name of the application you are working with. If not specified, no application will be used.
user
Name of the user you are connecting as. If not specified or empty, you will login as the Anonymous user.
password
Password for the specified user. If not specified, an empty password will be used.


Popis

This function creates a persistent connection to the SQL Server.

This has similar functionality to the wb_connect function, except for the following differences:

  1. 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.
  2. 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:

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.



Návratová hodnota

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.