PvConnectServer()
Attempts to connect to the target server that has the PSQL database engine installed. If connection is established successfully, a connection handle is returned for subsequent references.
Header File: connect.h (See also Header Files)
Function First Available In Library: w3dbav75.dll (Windows), libpsqldti.so (Linux), libpsqldti.dylib (OS X) (See also Link Libraries)
Syntax
BTI_SINT PvConnectServer(
   BTI_CHAR_PTR       serverName,
   BTI_CHAR_PTR       userName,
   BTI_CHAR_PTR       password,
   BTI_LONG_PTR       phConnection);
Arguments
 
See also Drive-based Formats in Getting Started With PSQL.
User name with which you will connect to the serverName.   See the Remarks section for information on omitting this parameter.
Return Values
 
Remarks
You must know the name of the server to which you want to connect. You can have open connections to multiple servers.
An application running locally where the database engine is running can omit the user name and password and still be able call any of the DTI functions and view or modify all configuration settings.
However, if the DTI application is running locally through a Terminal Services session or running remotely, provide the user name and password of a user with administrative level privileges on the server machine. This ensures that the application has full access for the DTI functions. Without administrator level privileges, an application returns an access error for most of the DTI functions. Only a subset of the functions work. For example, many of the functions that can modify configuration settings when full access is permitted are restricted to read-only access.
*Note: You must call PvStart() to initialize DTI 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()