Distributed Tuning Interface Reference : PvCreateDSN2()
 
PvCreateDSN2()
Creates a new engine data source name (DSN) and specifies the encoding option for data.
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 create client DSNs (or dsnadd utility on Linux and macOS).
Syntax
BTI_API PvCreateDSN2(
   BTI_LONG       hConnection,
   BTI_CHAR_PTR   pdsnName,
   BTI_CHAR_PTR   pdsnDesc,
   BTI_CHAR_PTR   pdsnDBQ,
   BTI_LONG       openMode,
   BTI_LONG       translate);
Arguments
 
In
hConnection
Connection handle that identifies the server. Connection handles are obtained with the PvConnectServer() function.
In
pdsnName
Name for the new DSN.
In
pdsnDesc
Description for the new DSN.
In
dsnDBQ
Database name to which this DSN will connect. This name must already exist. To create a database name, see PvCreateDatabase().
In
OpenMode
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.
In
translate
Encoding option for data, which can be one of the following:
DSNFLAG_DEFAULT
DSNFLAG_OEMANSI
DSNFLAG_AUTO
See also Encoding Translation 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_INVALID_NAME
The specified DSN name is invalid.
P_E_DSN_ALREADY_EXIST
The specified DSN name already exists.
P_E_ACCESS_RIGHT
Insufficient access right for the operation.
P_E_INVALID_OPEN_MODE
The specified open mode is invalid.
P_E_INVALID_TRANSLATE_OPTION
The specified encoding translation option is invalid.
P_E_FAIL
Failed to retrieve data path.
Remarks
This function creates engine DSNs only and requires a PSQL v10 client or later. To create a client DSN, you must use the ODBC API. (On Linux and macOS, you can also use the dsnadd utility to create a client DSN.)
The following preconditions must be met:
DTI session started by calling PvStart()
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.
The database name referenced in the pdsnDBQ parameter must already exist. To create a database name, see PvCreateDatabase().
See Also
PvStart()
PvConnectServer()
PvListDSNs()
PvModifyDSN()
PvGetDSN()
PvGetDSNEx()
PvDeleteDSN()
PvCountDSNs()
PvStop()