Sample ESQL/C program to connect to OneDB Server

Open “VS2017 Command Prompt” (or later version) window. You can use any text editor to use the below sample ESQL/C code, name it “ “ and save the file. Run “esql” command, it will generate esql-connect.exe executable file. Run this executable file. You should get the SUCCESS message. Refer below image for more information.

#include <stdio.h>
#include <windows.h>
printf("\n Sample ESQL Connect Program.\n");
EXEC SQL connect to 'sysmaster';
if (SQLCODE == 0)
printf(" Connected Successfully to 'sysmaster' database\n");
printf(" Connection error !!\n");
EXEC SQL disconnect current;
printf(" Sample Program over.\n");