Distributed Tuning Interface Guide
 
Distributed Tuning Interface Guide
The following topics introduce the PSQL Distributed Tuning Interface:
Overview of Distributed Tuning Interface
Basics Of Using DTI
Sample Programs For DTI
Common Tasks With DTI
You can also go directly to Distributed Tuning Interface Reference for detailed information on the use of DTI in PSQL.
Overview of Distributed Tuning Interface
The purpose of Distributed Tuning Interface (DTI) is to provide an application programming interface for configuration, monitoring, and diagnostics of PSQL components.
Note For brevity, throughout the rest of this manual Distributed Tuning Interface is referred to by as DTI.
String Arguments Encoding
A user application uses the client’s OS encoding at the API level. DTI handles internally the differences between OS encodings on the server and client.
If an older client is communicating with the server, the database engine assumes that the client is using an encoding compatible with those available on the server.
API Categories
The categories of available APIs are summarized in Table 2, DTI Function Groups.
Execution Privileges
Generally, you want your DTI application to be able to call any of the DTI functions and view or modify all configuration settings. To ensure this full access, connect to the server by providing a name and password of a user with administrative level privileges on the server machine. This applies if the DTI application is running locally through a Terminal Services session or running remotely. An application running locally can omit the user name and password and still be able call any of the DTI functions and view or modify all configuration settings. See Making a Connection to a Server Using DTI.
Without administrator level privileges, an application running locally through a Terminal Services session or running remotely 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.
Basics Of Using DTI
Header Files
The DTI functions are defined in the following header files:
btitypes.h
catalog.h
config.h
connect.h
ddf.h
dticonst.h
dtilicense.h
dtisecurity.h
monitor.h
Link Libraries
The following table lists the link libraries for DTI and the PSQL version in which the library was first available. Link your application to the appropriate library as defined in the table.
Table 1 DTI Link Libraries for Windows, Linux, and macOS
Library1
Windows
Linux
macOS
Version of PSQL Library First Available
w3dbav90.lib2
32-bit
 
 
PSQL v9.0
w64dba.lib
64-bit
 
 
PSQL v10.0
w3dbav80.lib2
32-bit
 
 
Pervasive.SQL V8.0
w3dbav78.lib2
32-bit
 
 
Pervasive.SQL 2000i (SP3)
w3dbav75.lib2
32-bit
 
 
Pervasive.SQL 2000
libpsqldti.so
 
32-bit
 
Pervasive.SQL V8.5
libpsqldti.so
 
64-bit
 
PSQL 10.10
libpsqldti.dylib
 
 
64-bit
PSQL v12.01
1 All libraries have been compiled with Microsoft Visual Studio 2015.
2 Each 32-bit library is a superset of the previous library. For example, w3dbav90.lib is a superset of w3dbav75.lib, w3dbav78.lib, and w3dbav80.lib.
The functions for the DTI are documented in Distributed Tuning Interface Reference.
Before Calling Any Functions
When you want to invoke DTI, you must first call the PvStart() function. Then you can call multiple DTI functions before ending the session.
When ending a session, you must call PvStop() to close the session.
Sample Programs For DTI
By default, the runtime files for the DTI access method are installed with the PSQL database engine and with PSQL Client. At a minimum, you need PSQL Client to create a DTI application.
The header files and sample files are available by online download. Sample files pertaining to a particular development environment are installed in separate directories, as shown in the following table.
Development Environment
Location
MS Visual C++ 8
install_location\SAMPLES\MSVC2005
MS Visual C++ 7
install_location\SAMPLES\MSVC2003
MS Visual C++ 6
install_location\SAMPLES\MSVC
Delphi 5
install_location\SAMPLES\DELPHI5
For additional information, see the DTI release notes (readme_dti.htm) installed with the PSQL database engine.
Common Tasks With DTI
This section outlines key tasks that are often used with DTI.
Making a Connection to a Server Using DTI
This documents the procedure for obtaining a connection handle to a server, which is a first step for many DTI functions.
To obtain a Connection handle to a server
1 Start a DTI session
// initialize status code return
BTI_LONG status = 0;
// Call PvStart function with its reserved
// parameter
status = PvStart(0);
2 Connect to a server
// initialize variables
BTI_LONG status = 0;
BTI_CHAR_PTR uName = "jsmith";
BTI_CHAR_PTR pword = "123";
BTI_CHAR_PTR svrName = "myserver";
BTI_LONG hConn = 0xFFFFFFFF;
// after execution, hConn contains connection
// handle to pass to other functions
status = PvConnectServer(svrName, uName, pword, &hConn);
// if status != 0, handle errors now
Connection handles are required by many DTI functions. You can have multiple connections open at a time. For each connection or handle, however, you should call the PvDisconnect() function to release the handle.
status = PvDisconnect(phConn);
Obtaining a Setting ID Using DTI
Many of the configuration functions take a setting ID as a parameter. This procedure describes the prerequisite functions for obtaining a setting ID.
To obtain the ID for a Specific Setting
1 Perform the procedure Making a Connection to a Server Using DTI to obtain a connection handle.
2 Using the connection handle returned by PvConnectServer(), obtain a list of categories by calling PvGetCategoryList().
3 For each category, get the list of settings using PvGetSettingList() and the settings count using PvGetSettingListCount().
4 Scan for the setting that you want.
5 Retrieve information about the setting using PvGetSettingInfo().
6 When done, disconnect from the server by calling PvDisconnect().
7 End the DTI session by calling PvStop().
Passing a DTI Structure as a Parameter
Many functions require that you pass a DTI structure when making the functional call. The following code segment shows an example of a function call including a structure. See DTI Structures for more information about DTI structures.
WORD rValue = P_OK;
TABLEMAP* tableList;
WORD tableCount;
rValue = PvGetTableNames(m_DictHandle, &tableList, &tableCount);