You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version 2.0 of the documentation site at [code.kx.com/q](https://code.kx.com/q).
7
-
8
-
4
+
Source for [code.kx.com/q](https://code.kx.com/q).
9
5
10
6
Platform
11
7
--------
@@ -14,18 +10,3 @@ This site is generated with the [MkDocs](https://mkdocs.org/) static-site genera
14
10
15
11
See [`install.md`](CONTRIBUTING/install.md) for how to compile the site.
16
12
17
-
18
-
Not upwardly compatible
19
-
-----------------------
20
-
21
-
Version 2.0 substantially reorganizes the URL structure of the site.
22
-
Most keywords and operators now have short URLs, e.g. code.kx.com/q/ref/aj and code.kx.com/q/ref/fill.
23
-
24
-
This marks a break from [Version 1.0](https://github.com/kxsystems/docs-v1/).
25
-
There is no Git continuity between the two repos.
26
-
27
-
The terminology revision begun in Version 1.0 is complete: _adverbs_ are now _iterators_. The Reference material for them has been completely rewritten and the 2013 whitepaper “Efficient use of adverbs” re-issued as [“Iterators”](https://code.kx.com/q/wp/iterators/). The concept of _rank_ is extended from functions to all applicable values. _Variadic_ replaces _ambivalent_ for values (e.g. derived functions and matrixes) that may be applied as either unary or binary.
28
-
29
-
The Cookbook articles are now in the [Knowledge Base](https://code.kx.com/q/kb/).
Copy file name to clipboardExpand all lines: docs/basics/errors.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -620,7 +620,7 @@ On launch
620
620
621
621
error | explanation
622
622
------|------------
623
-
{timestamp} couldn't connect to license daemon | Could not connect to KX license server ([kdb+ On Demand](../learn/licensing.md#licensing-server-for-kdb-on-demand))
623
+
{timestamp} couldn't connect to license daemon | Could not connect to KX license server ([kdb+ On Demand](../learn/licensing.md#licensing-server))
624
624
[](){#cores}cores | The license is for [fewer cores than available](../learn/licensing.md#core-restrictions)
625
625
[](){#cpu}cpu | The license is for fewer CPUs than available
626
626
[](){#exp}exp | License expiry date is prior to system date
Currently the applications may run on the following platforms: w64, w32, l64, l32. Primary compatibility target has been [Tableau](https://www.tableau.com/), although other uses are welcome.
@@ -15,25 +14,52 @@ Requirements: V3.2 or later.
15
14
16
15
!!! tip "Reporting problems"
17
16
18
-
When reporting a problem (e.g. SQL error, wrong results, slowness, segfault etc.) make sure to include steps to reproduce along with your ODBC trace.
17
+
When reporting a problem (e.g. SQL error, wrong results, slowness, segfault etc.) make sure to include steps to reproduce along with your [ODBC trace](#debugging).
19
18
20
19
:fontawesome-regular-map: [**Data visualization with kdb+ using ODBC**: a Tableau case study](../wp/data-visualization/index.md"White paper")
21
20
22
-
23
21
## Installation
24
22
25
-
### Windows
23
+
### kdb+ configuration
24
+
25
+
The kdb+ process should be [listening on port](../basics/listening-port.md) which relates to the port choosen and defined in the odbc configuration.
26
+
27
+
Unzip qodbc3.zip, and copy `ps.k` to `$QHOME`. Ensure you have `ps.k` loaded into the kdb+ process:
28
+
29
+
```q
30
+
q)\l ps.k
31
+
```
32
+
33
+
Run `.s.ver` to check that ps.k has been loaded and for the current version e.g.
34
+
```q
35
+
q).s.ver
36
+
1.15
37
+
```
38
+
39
+
The following is an example of starting kdb+ with ps.k listening on port 5000
40
+
41
+
```bash
42
+
q ps.k -p 5000
43
+
```
44
+
45
+
### ODBC driver and DSN configuration
46
+
47
+
Software that uses ODBC connections refer to individual connections using a `DSN`(Data Source Name).
48
+
The DSN details the ODBC driver (e.g. qodbc3) and connection details specific to the data source (e.g. hostname, username, etc).
49
+
50
+
The following details adding a new DSN to connect to kdb+:
51
+
52
+
#### Windows
53
+
54
+
The following details installing the ODBC driver and configuring a user or system DSN as an administrator.
26
55
27
56
1. Close Tableau or anything that uses ODBC
28
57
2. Extract qodbc3.zip to temporary location. Go to the directory corresponding to your OS architecture (w64 or w32)
29
58
3. Run `d0.exe` as Administrator. This will copy `qodbc3.dll` to the correct location – you don’t need to do that yourself.
30
59
4. You will now be able to add new kdb+ DSNs (data sources) in the `ODBC Data Source Administrator (64-bit)` (or `32-bit` if on 32-bit OS). Make sure to select `kdb+(odbc3)` in the list of drivers. You will be prompted for DSN name, hostname, port, username and password.
31
-
5. In the ODBC data source administrator, click _Start Tracing_ on the _Tracing_ tab.
32
-
6. Copy `q.tdc` to My Documents\My Tableau Repository\Datasources
33
-
7. Copy `ps.k` to `$QHOME`
34
-
60
+
5. Use `Test Connection` within the DSN configuration screen to check that the connection to kdb+ is working.
The ODBC driver should be installed in the corresponding system `ini` file and a DSN entry created in either the system data sources (for all users) or user data source (current user).
74
+
The linux `odbcinst` tool can be used to find these locations if not known, for example:
75
+
76
+
```bash
77
+
$ odbcinst -j
78
+
unixODBC 2.3.7
79
+
DRIVERS............: /etc/odbcinst.ini
80
+
SYSTEM DATA SOURCES: /etc/odbc.ini
81
+
FILE DATA SOURCES..: /etc/ODBCDataSources
82
+
USER DATA SOURCES..: /root/.odbc.ini
83
+
SQLULEN Size.......: 8
84
+
SQLLEN Size........: 8
85
+
SQLSETPOSIROW Size.: 8
86
+
```
87
+
88
+
Add the driver to your list of drivers by editing the driver `ini` file ( `/etc/odbcinst.ini`). An example of the definition follows (note: the driver location should be altered to the location chosen on your system):
89
+
90
+
```ini
91
+
[kdb+(odbc3)]
92
+
Description = ODBC for kdb+
93
+
Driver = /src/qodbc3/l64/qodbc3.so
94
+
```
95
+
96
+
After adding, this can be verified by listing the system ODBC drivers:
97
+
98
+
```bash
99
+
$ odbcinst -q -d
100
+
[PostgreSQL]
101
+
[MySQL]
102
+
[FreeTDS]
103
+
[MariaDB]
104
+
[kdb+(odbc3)]
105
+
```
106
+
107
+
Add a DSN entry to your system data source file (`/etc/odbc.ini`) or user data source file (`~/.odbc.ini`), with the appropriate settings to communicate with the kdb+ server. For example:
48
108
49
109
```ini
50
110
[your_dsn_name]
51
111
Description=kdb+
52
-
Driver=/path/to/qodbc3.so
53
-
HOST=your.host:port
112
+
Driver=kdb+(odbc3)
113
+
HOST=localhost:5000
54
114
UID=username
55
115
PWD=password
56
116
```
57
117
58
-
You should now be able to connect to your DSN with `isql`:
118
+
You should now be able to connect to kdb+ represented by the DSN with `isql`:
59
119
60
120
```bash
61
121
$ isql -3 -v -k 'DSN=your_dsn_name;'
62
122
```
63
123
124
+
### Tableau configuration
64
125
65
-
## Running
126
+
If there is a requirement to connect Tableau with kdb+, copy `q.tdc` to the appropriate directory for your application as detailed [here](https://help.tableau.com/current/pro/desktop/en-us/connect_customize.htm#installing-tdc-and-properties-files).
66
127
67
-
Ensure you have `ps.k` loaded into the kdb+ process specified in your DSN:
68
-
69
-
```q
70
-
q)\l ps.k
71
-
```
128
+
Follow the Tableau directions for restarting Tableau Desktop/Server after the file is copied to the appropriate location.
72
129
73
-
The kdb+ process should also be [listening on port](../basics/listening-port.md) which relates to the port choosen and defined in the odbc configuration.
130
+
The `q.tdc` file is a `Tableau Datasource Customization` (TDC) file to customize Tableau-specific settings for the kdb+ ODBC connection. The driver name within the file must match the name of the kdb+ driver installed (`kdb+(odbc3)`).
74
131
132
+
!!! note "The destination directory can be different depending on whether Tableau Desktop or Tableau Server is being used"
75
133
76
-
## Notes
134
+
## Tableau Notes
77
135
78
136
To use q from Tableau’s Custom SQL use the `q()` function, e.g.:
79
137
@@ -83,9 +141,6 @@ To use q from Tableau’s Custom SQL use the `q()` function, e.g.:
83
141
84
142
Parameters can be supplied by Tableau. Note that Tableau’s _string_ type corresponds to q’s symbol and _datetime_ corresponds to timestamp.
85
143
86
-
`test.q` provides additional examples of SQL usage, including the create/insert/update/delete statement syntax.
87
-
88
-
89
144
## Compatibility
90
145
91
146
The driver translates SQL expressions into q and inherits q’s data model. This gives rise to the following SQL compatibility issues:
@@ -97,3 +152,69 @@ The driver translates SQL expressions into q and inherits q’s data model. This
97
152
98
153
Also, SQL selects from partitioned tables are not supported – one should pre-select from a partitioned table using the `q()` function instead.
99
154
155
+
`test.q` provides additional examples of SQL usage, including the create/insert/update/delete statement syntax.
156
+
157
+
## Debugging
158
+
159
+
ODBC implementations provide a tracing capability to log interactions with an ODBC driver. This can aid in diagnosing any issues. Tracing can have a detremental
160
+
effect to ODBC performance.
161
+
162
+
This is a feature of the ODBC system, and not a feature unique to the kdb+ driver. Associated documentation, features, and troubleshooting can be found online for your OS.
163
+
164
+
!!! warn "Connection details can be logged, therefore the log file should be stored in a private location"
165
+
166
+
### Windows
167
+
168
+
In the ODBC data source administrator, click _Start Tracing_ on the _Tracing_ tab.
169
+
170
+
See below an example of the data recorded to the `SQL.LOG`:
171
+
172
+
```txt
173
+
powershell da8-9a0 ENTER SQLExecDirectW
174
+
HSTMT 0x00000256C37A6920
175
+
WCHAR * 0x00000256AA98112C [ -3] "SELECT * FROM t\ 0"
176
+
SDWORD -3
177
+
...
178
+
powershell da8-9a0 EXIT SQLGetData with return code 0 (SQL_SUCCESS)
179
+
HSTMT 0x00000256C37A6920
180
+
UWORD 2
181
+
SWORD -8 <SQL_C_WCHAR>
182
+
PTR 0x00000256A79BB1D0 [ 2] "1"
183
+
SQLLEN 4092
184
+
SQLLEN * 0x000000DAA198E160 (2)
185
+
```
186
+
187
+
Please ensure tracing is disabled after debugging complete.
188
+
189
+
### Linux
190
+
191
+
In the `[ODBC]` section of the driver `ini` file (`/etc/odbcinst.ini`), set `Trace` to `1` to enable tracing and `TraceFile` to the location of the log file to create.
192
+
Additional configuration options are available. For example:
193
+
194
+
```txt
195
+
[ODBC]
196
+
Trace = 1
197
+
TraceFile = /tmp/odbc.log
198
+
TraceOptions = 3
199
+
ODBCTraceFlush = 1
200
+
```
201
+
202
+
An example of the data recorded:
203
+
```txt
204
+
[ODBC][194][1729684200.251390][SQLPrepare.c][196]
205
+
Entry:
206
+
Statement = 0x55ba1f4cdb30
207
+
SQL = [select * from t][length = 15]
208
+
...
209
+
[ODBC][194][1729684200.252562][SQLGetData.c][237]
210
+
Entry:
211
+
Statement = 0x55ba1f4cdb30
212
+
Column Number = 1
213
+
Target Type = 1 SQL_CHAR
214
+
Buffer Length = 301
215
+
Target Value = 0x55ba1f4cfd10
216
+
StrLen Or Ind = 0x7ffe4093ef20
217
+
```
218
+
219
+
Please ensure tracing is disabled after debugging complete.
Copy file name to clipboardExpand all lines: docs/learn/licensing.md
+25-43Lines changed: 25 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,29 +17,6 @@ Everyone. All use of kdb+ is governed by a license.
17
17
18
18
<!-- :fontawesome-regular-hand-point-right: [Licenses](https://kx.com/connect-with-us/licenses/) at kx.com -->
19
19
20
-
21
-
=== "Non-commercial use"
22
-
23
-
Free 64-bit kdb+ On-Demand Personal Edition is for personal, non-commercial use.
24
-
Currently, it may be used on up to 2 computers, and up to a maximum of 16 cores per computer, but is not licensed for use on any cloud – only on personal computers.
25
-
It may not be used for any commercial purposes.
26
-
See the [full terms and conditions](https://kx.com/download-kdb/).
27
-
28
-
It requires a `kc.lic` license key file and an always-on internet connection to operate.
29
-
30
-
31
-
=== "Commercial use"
32
-
33
-
Use of commercial kdb+ is covered by your license agreement with KX.
34
-
35
-
Your copy of kdb+ will need access to a valid license key file.
36
-
37
-
If you wish to begin using kdb+ commercially, please contact sales@kx.com.
38
-
39
-
40
-
## License key files
41
-
42
-
All 64-bit versions of kdb+ need a valid license key file to run.
43
20
Without one, kdb+ signals an [error](../basics/errors.md#license-errors)`'k4.lic` and aborts.
44
21
45
22
```txt
@@ -56,13 +33,35 @@ If both are found, the `kc.lic` file is used.
56
33
57
34
## Obtain a license key file
58
35
36
+
A license file can be a commercial license or an on-demand person license (for non-commercial use).
37
+
59
38
### On-Demand
60
39
61
-
Follow the [download instructions](https://kx.com/kdb-personal-edition-download/) to get your kc.lic.
40
+
Free 64-bit kdb+ On-Demand Personal Edition is for personal, non-commercial use.
41
+
Currently, it may be used on up to 2 computers, and up to a maximum of 16 cores per computer, but is not licensed for use on any cloud – only on personal computers.
42
+
It may not be used for any commercial purposes.
43
+
See the [full terms and conditions](https://kx.com/download-kdb/). Follow the [download instructions](https://kx.com/kdb-personal-edition-download/) to get your kc.lic.
44
+
45
+
It requires a `kc.lic` license key file and an always-on internet connection to operate.
46
+
47
+
#### Licensing server
48
+
49
+
If kdb+ with an on-demand license cannot contact the KX license server it will abort with a timestamped message.
50
+
51
+
```q
52
+
'2018.03.28T11:20:03.831 couldn't connect to license daemon -- exiting
53
+
```
54
+
55
+
If an HTTP proxy is required, the environment variables `http_proxy` or `HTTP_PROXY` define the URL of the HTTP proxy to use.
56
+
Since 4.1t 2022.11.01,4.0 2022.10.26,4.0ce 2022.09.16 the on-demand system honours the NO_PROXY/no_proxy environment variables, with the lowercase version taking precedence.
62
57
63
58
### Commercial
64
59
65
-
To begin using kdb+ commercially, contact sales@kx.com.
60
+
Use of commercial kdb+ is covered by your license agreement with KX.
61
+
62
+
Your copy of kdb+ will need access to a valid license key file.
63
+
64
+
If you wish to begin using kdb+ commercially, please contact sales@kx.com.
66
65
67
66
## Install the license key file
68
67
@@ -88,7 +87,7 @@ If you are sharing use of a commercial license, you will probably want to set th
88
87
A list of possible errors can be found [here](../basics/errors.md#license-errors).
89
88
90
89
91
-
## Keeping the license key file elsewhere
90
+
###Keeping the license key file elsewhere
92
91
93
92
The default location for the license key file is the `QHOME` folder. You do not have to keep the license key file there. You can use the environment variable `QLIC` to specify a different filepath.
94
93
@@ -100,22 +99,6 @@ The default location for the license key file is the `QHOME` folder. You do not
100
99
QLIC='/Users/simon/q'
101
100
```
102
101
103
-
104
-
## Licensing server for kdb+ On Demand
105
-
106
-
As well as a license key file, kdb+ On Demand also requires frequent contact with the KX licensing server.
107
-
For this you need an always-on Net connection.
108
-
109
-
If kdb+ cannot contact the KX server it will abort with a timestamped message.
110
-
111
-
```q
112
-
'2018.03.28T11:20:03.831 couldn't connect to license daemon -- exiting
113
-
```
114
-
115
-
If an HTTP proxy is required, the environment variables `http_proxy` or `HTTP_PROXY` define the URL of the HTTP proxy to use.
116
-
Since 4.1t 2022.11.01,4.0 2022.10.26,4.0ce 2022.09.16 the on-demand system honours the NO_PROXY/no_proxy environment variables, with the lowercase version taking precedence.
117
-
118
-
119
102
## Core restrictions
120
103
121
104
If the license is for fewer cores than the total number on the machine, the number of cores available to kdb+ must be [restricted with OS programs](../kb/cpu-affinity.md), or kdb+ will signal `'cores` and abort.
@@ -150,7 +133,6 @@ The number of licensed cores is always 16 for the on-demand license.
150
133
scutil --set HostName "mymbp.local"
151
134
```
152
135
153
-
154
136
## License questions
155
137
156
138
Designated Contacts should send license questions to licadmin@kx.com.
0 commit comments