PvConnectServer()
Chapter contents
Attempts to connect to the target server that has Pervasive database server installed. If connection is established successfully, a connection handle is returned for subsequent references.
Header file: CONNECT.H
Requires: W3DBAV75.DLL or higher version
Syntax
BTI_SINT PvConnectServer(
BTI_CHAR_PTR serverName,
BTI_CHAR_PTR userName,
BTI_CHAR_PTR password,
BTI_LONG_PTR phConnection);
Arguments
|
In
|
serverName
|
Server name to which you want to connect.
|
|
In
|
userName
|
User name with which you will connect to the serverName. See the Remarks section for information on omitting this parameter.
|
|
In
|
password
|
User password. See the Remarks section for information on omitting this parameter.
|
|
In/Out
|
phConnection
|
Address of a long integer that receives the connection handle if connection is successful.
|
Return Values
|
P_OK
|
The operation was successful.
|
|
P_E_NULL_PTR
|
Call with NULL pointer.
|
|
P_E_FAIL
|
Failed to connect to the named server.
|
|
P_E_SERVER_NOT_FOUND
|
The specified server was not found
|
|
P_E_ENGINE_NOT_LOADED
|
The specified engine is not running.
|
|
P_E_REQUESTER_NOT_LOADED
|
The client requester is not loaded.
|
|
P_E_SERVER_TABLE_FULL
|
The internal server name table is full.
|
|
P_E_CLIENT_CONNECTIONS_LIMIT_REACHED
|
The operation could not connect because the limit on client connections has been reached. Check the configuration of the server.
|
|
P_E_PERMISSION_ERROR
|
The operation encountered a permissions error.
|
|
P_E_NO_MEMORY
|
The operation encountered a memory error.
|
|
P_E_NO_AVAILABLE_TRANSPORT
|
No remote connection could be established.
|
|
P_E_CONNECTION_LOST
|
The remote connection to the server was lost.
|
Remarks
You must know the name of the server to which you want to connect. You can have open connections to multiple servers.
You can omit the username and password parameters and still use a subset of the DTI functions. For more explanation and a list of these functions, see Overview of Pervasive Distributed Tuning Interface .
Note
You must call PvStart() to initialize the Distributed Tuning Interface before attempting to connect to a server using this function.
Example
BTI_CHAR_PTR uName = "jsmith";
BTI_CHAR_PTR pword = "123";
BTI_CHAR_PTR svrName = "myserver";
BTI_LONG_PTR phConn = 0xFFFFFFFF;
BTI_SINT status = 0;
status = PvConnectServer(svrName,
uName,
pword,
&phConn);
See Also
PvStart()
PvGetServerName()
PvDisconnect()
PvStop()