Pulse
Allows kdb developers to easily create real-time interactive dashboards direct from kdb data.
Allows kdb developers to easily create real-time interactive dashboards direct from kdb data.
Examples of connecting, querying and subscribing using the C API for linux are available to download and are detailed below:
We will use the two methods shown below to connect and query kdb:
The Interfacing Kdb with C page on the code KX website details the full API specificiation.
Signature | Notes |
---|---|
int c = khpu("localhost", 1234,"myusername:mypassword"); | Connect to a kdb server on the localhost port 1234. |
result=k(handle,"([]a:til 10;b:reverse til 10;c:10?`4)",(K)0) | Send a synchronous message in string format to a server and return the result. |
Code KX has a simple example of querying that relies on a q server to be running on port 12001.
To compile and run the example for kdb < version 3, do the following in linux:
-lpthread
- links in the posix threads library that is needed
-m64
- generates code for a 64 bit environment, setting int to 32 bits and long and pointer types to 64 bits
The svn uses -r as you need the old revisions of the library/header, these can also be downloaded
qc-eg.zip and here
The main difference with kdb version 3.0+ is that we must make sure to specify the environment variable KXVER.
Kdb must be running on the local machine port 12001.
The major steps involved in kx's example csv.c to connect and query a kdb server are:
khpu(host, port, "user:pass")
result=k(handle,"select...",(K)0)
kclose(handle)
K
.