Distributed Tuning Interface Reference : PvGetDSNEx2()
 
PvGetDSNEx2()
Retrieves information about the data source name (DSN). This function is the same as PvGetDSNEx() except that the encoding option for data is also retrieved.
Header File: catalog.h (See also Header Files)
Function First Available In Library: w3dbav90.dll (Windows), libpsqldti.so (Linux), libpsqldti.dylib (macOS) (See also Link Libraries)
This function is deprecated in PSQL v11 and higher versions. Use the ODBC API to work with client DSNs.
Syntax
BTI_API PvGetDSNEx2(
   BTI_LONG           hConnection,
   BTI_CHAR_PTR       dsnName,
   BTI_ULONG_PTR      pdsnDescSize,
   BTI_CHAR_PTR       dsnDesc,
   BTI_ULONG_PTR      pdsnDBQSize,
   BTI_CHAR_PTR       dsnDBQ,
   BTI_LONG_PTR       pOpenMode,
   BTI_LONG_PTR       translate);
Arguments
 
In
hConnection
Connection handle that identifies the server. Connection handles are obtained with the PvConnectServer() function.
In
dsnName
Name of the datasource. A list of DSNs can be obtained with the PvListDSNs() function.
In/Out
pdsnDescSize
Address of an unsigned long containing size of the buffer for DSN description. Receives actual size of DSN description.
Out
dsnDesc
Contains the description of DSN if successful.
In/Out
pdsnDBQSize
Address of an unsigned long containing size of the buffer for name of database. Receives actual size of database name.
Out
dsnDBQ
Contains the name of the database if successful.
Out
pOpenMode
Open mode for the DSN, which is one of the following:
NORMAL_MODE
ACCELERATED_MODE
READONLY_MODE
EXCLUSIVE_MODE
See also DSN Open Mode in ODBC Guide.
Out
translate
Encoding option for data, which can be one of the following:
DSNFLAG_DEFAULT
DSNFLAG_OEMANSI
DSNFLAG_AUTO
See also DSN Open Mode in ODBC Guide. Note that DSNFLAG_DEFAULT corresponds to the “None” encoding option in ODBC Administrator.
Return Values
 
P_OK
The operation was successful.
P_E_INVALID_HANDLE
Invalid connection handle.
P_E_NULL_PTR
Call with NULL pointer
P_E_BUFFER_TOO_SMALL
The buffer is too small for the string. In this case, the required buffer size is returned in pdsnDescSize or pdsnDBQSize.
P_E_ACCESS_RIGHT
Insufficient access right for the operation.
P_E_DSN_DOES_NOT_EXIST
The specified DSN does not exist.
P_E_INVALID_OPEN_MODE
Invalid open mode.
P_E_INVALID_TRANSLATE_OPTION
The specified encoding translation option is invalid.
P_E_FAIL
Failed to retrieve data path.
Remarks
The following precondition must be met:
Connection established by PvConnectServer() or if you are performing the operation on a local machine, P_LOCAL_DB_CONNECTION may be used as the connection handle.
To retrieve information about a DSN without having to prompt the user to login, pass empty strings for username and password when establishing the server connection with PvConnectServer().
Note The connection established by passing empty strings for username and password is an insecure connection, and will not have sufficient rights to perform most of the other operations in DTI.
See Also
PvConnectServer()
PvCountDSNs()
PvCreateDSN2()
PvDeleteDSN()
PvDisconnect()
PvGetDSNEx()
PvListDSNs()
PvModifyDSN2()
PvStart()
PvStop()