Author: Michael Reynolds works as a kdb+ consultant for one of the largest investment banks in the world. As part of his daily job, Michael is responsible for maintaining kdb+ databases as well as a C# APIs and plug-ins.
Over the course of fifteen years, C# has become one of the most commonly utilised programming languages in the world. It has been used in applications ranging from computer games to medical systems to storage systems.
When deployed in an environment which requires database connections, it is traditional for C# to use a form of SQL for the back end, be it MySQL or SQLite to provide data storage and the ability to execute queries. Though functional, kdb+ offers substantial improvements in performance and processing power over this standard method of operation.
In this paper, we will explain the basics of using C# to open connections to kdb+ processes running on remote servers as well as setting up a basic API that will allow for authentication, error recovery and basic queries through an interface. In this case, all C# code will be pointing to the same kdb+ process.
C# is heavily integrated into Windows software. It allows for the implementation of the .NET environment into applications and can be utilised in the creation of websites using PHP and ASP.NET as well as stand-alone Windows applications.
The paper makes use of the standard c.cs file offered by Kx to enable connections to C#. This can be found here
It is important to note that this paper does not aim to provide a full C# library, but instead give guidance on how to quickly and easily allow a C# application to connect to and run queries against a kdb+ process.
All kdb+ code will be highlighted in grey boxes and C# code in white.
The C# source code for this paper can be found on the First Derivatives GitHub page
Sponsored by Kx Systems