Create a connection
Create a connection by using the CreateConnection Method.
The connection can be:
- an ODBC connection
- an OLEDB connection
- a custom connection
- a folder connection (lib connection)
- an internet connection
- Single Sign-On
Examples
Example 1:
1. Create the first folder connection (qName is Connection01 and qType is folder). The UNC path of the folder connection is given in qConnectionString.
The client sends:
The engine returns:
The first folder connection is created. The identifier of the connection (in qConnectionId) is produced by the engine and is unique.
2. Create the second folder connection (qName is Connection02 and qType is folder). The UNC path of the folder connection is given in qConnectionString.
The client sends:
The engine returns:
The second folder connection is created. The identifier of the connection (in qConnectionId) is produced by the engine and is unique.
3. Get the list of connections and information about each connection.
The client sends:
The engine returns:
The app contains two connections.
The engine returns:
- The creation time of each connection in qModifiedDate
- The identifier of each connection in qId.
- The type of the connection. Both connections are folder connections (qType is folder).
- The name of each connection in qName.
- The connection string in qConnectionString.
4. Get information about the first folder connection (qId is 4E629259-0909FFC0-153F5CA9-2021D66F-DA67E1C6).
The client sends:
The engine returns:
The name, type, modified date and connection string of the connection are returned.
Example 2:
The name of the connection is Connection01.
The type of the connector is QvEventLogConnectorSimple.exe. It corresponds to the name of the custom connector file.
The client sends:
The engine returns:
The custom connection is created. The connection identifier is returned.
Example 3:
Create a ODBC connection to a SAP HANA database using SSO. The user has admin rights.
In this example, the user rd-testkerb04 is used. This user is defined in the SAP HANA database and this user has the right to see all countries that have been defined in the regions Asia, Europe and America.
-
The user rd-testkerb04 creates an app named kerb04_DD.qvf .
{ "jsonrpc": "2.0", "id": 2, "method": "CreateApp", "handle": -1, "params": [ "kerb04_DD.qvf" ] } RECEIVE: --- 56772630 [-2] { "jsonrpc": "2.0", "method": "OnAuthenticationInformation", "params": { "userId": "rd-testkerb04", "userDirectory": "QTSEL", "logoutUri": "https://selun-smu2.qliktech.com:443/qps/user", "mustAuthenticate": false } -
Create an ODBC connection using SSO (qLogon is LOG_ON_CURRENT_USER)
{ "jsonrpc": "2.0", "id": 8, "method": "CreateConnection", "handle": 1, "params": [ { "qId": "", "qName": "SAPHANA_CONNECTION", "qConnectionString": "ODBC CONNECT TO ProtocolTester_SAPHANA", "qType": "ODBC", "qUserName": "", "qPassword": "", "qModifyDate": "", "qMeta": {}, "qLogon": "LOG_ON_CURRENT_USER" } ] } RECEIVE: --- 56772630 [8] { "jsonrpc": "2.0", "id": 8, "result": { "qConnectionId": "8122c4e6-e7c7-41a4-8d2e-83ea936274df" } } -
Save the app
{ "jsonrpc": "2.0", "id": 9, "method": "DoSave", "handle": 1, "params": [] } RECEIVE: --- 56772630 [9] { "jsonrpc": "2.0", "id": 9, "result": {}, "change": [ 1 ] } -
Check that the user rd-teskerb04 can see the regions Asia, Europe and America and the countries that were defined.
{ "jsonrpc": "2.0", "id": 10, "method": "GetDatabaseTablePreview", "handle": 1, "params": [ "8122c4e6-e7c7-41a4-8d2e-83ea936274df", "", "_SYS_BIC", "QLIK_SSO_REGION/CALCULATION_VIEW_REGION" ] } RECEIVE: --- 56772630 [10] { "jsonrpc": "2.0", "id": 10, "result": { "qPreview": [ { "qValues": [ "COUNTRY", "REGION", "COUNTRY_ID", "REGION_ID", "SomeMeasure", "SomeMeasure2" ] }, { "qValues": [ "India", "Asia", "3", "1", "3", "1" ] }, { "qValues": [ "Japan", "Asia", "4", "1", "4", "1" ] }, { "qValues": [ "Germany", "Europe", "5", "2", "5", "1" ] }, { "qValues": [ "Sweden", "Europe", "6", "2", "6", "1" ] }, { "qValues": [ "USA", "America", "1", "3", "1", "1" ] }, { "qValues": [ "Argentina", "America", "2", "3", "2", "1" ] } ] } }
The user can see the regions Asia, Europe and America and can see the countries India, Japan, Argentina, Sweden, Germany and USA.
Example 4:
Create a ODBC connection to a SAP HANA database using SSO. The user has restricted rights.
In this example, the user rd-testkerb01 is used. This user is defined in the SAP database and this user has the right to see all countries that have been defined in the regions Asia. This user is not allowed to see the regions Europe and America.
-
The user rd-testkerb01 creates an app named kerb01_DD.qvf .
{ "jsonrpc": "2.0", "id": 2, "method": "CreateApp", "handle": -1, "params": [ "kerb01_DD.qvf" ] } RECEIVE: --- 63019771 [-2] { "jsonrpc": "2.0", "method": "OnAuthenticationInformation", "params": { "userId": "rd-testkerb01", "userDirectory": "QTSEL", "logoutUri": "https://selun-smu2.qliktech.com:443/qps/user", "mustAuthenticate": false } } -
Create an ODBC connection using SSO (qLogon is LOG_ON_CURRENT_USER)
{ "jsonrpc": "2.0", "id": 7, "method": "CreateConnection", "handle": 1, "params": [ { "qId": "", "qName": "SAPHANA_CONNECTION", "qConnectionString": "ODBC CONNECT TO ProtocolTester_SAPHANA", "qType": "ODBC", "qUserName": "", "qPassword": "", "qModifyDate": "", "qMeta": {}, "qLogon": "LOG_ON_CURRENT_USER" } ] } RECEIVE: --- 63019771 [7] { "jsonrpc": "2.0", "id": 7, "result": { "qConnectionId": "227835dd-0e2e-4b51-95e1-789deb18e83b" } } -
Check that the user rd-teskerb01 can only see the region Asia and the countries that were defined.
{ "jsonrpc": "2.0", "id": 8, "method": "GetDatabaseTablePreview", "handle": 1, "params": [ "227835dd-0e2e-4b51-95e1-789deb18e83b", "", "_SYS_BIC", "QLIK_SSO_REGION/CALCULATION_VIEW_REGION" ] } RECEIVE: --- 63019771 [8] { "jsonrpc": "2.0", "id": 8, "result": { "qPreview": [ { "qValues": [ "COUNTRY", "REGION", "COUNTRY_ID", "REGION_ID", "SomeMeasure", "SomeMeasure2" ] }, { "qValues": [ "India", "Asia", "3", "1", "3", "1" ] }, { "qValues": [ "Japan", "Asia", "4", "1", "4", "1" ] } ] } }
The user can see the region Asia and the countries India and Japan.