OpenVMS Source Code Demos
mysql_demo01
//==============================================================================
// title : mysql_demo01.c
// author : Neil Rieck ( http://neilrieck.net MAILTO:n.rieck@bell.net )
// : Waterloo, Ontario, Canada.
// created : 2014-01-27
// purpose : a 'hello world' program for MariaDB (an alternative fork of MySQL)
// target : for MariaDB on OpenVMS-8.4
// vms-build : @mysql_demo.com mysql_demo1.c (see mysql_demo.com for details)
// references : http://zetcode.com/db/mysqlc/ (MySQL C API programming tutorial)
// http://www.yolinux.com/TUTORIALS/MySQL-Programming-C-API.html
// http://code-reference.com/c/mysql/mysql.h/mysql_real_connect
//==============================================================================
#define __NEW_STARLET 1 // enable strict starlet (>= OpenVMS70)
//
// ANSI C headers
//
#include <stdio.h> //
#include <stdlib> //
//
// MySQL headers (directory: 'mysql055_root:[include.mysql]')
//
// The next include is okay for MultiNet but will cause problems with "TCPIP
// Services" or TCPware (throws error: "-F- Cannot find file <fenv.h>").
// For those stacks just comment out the next line.
#include <my_global.h> // MultiNet only
#include <mysql.h> //
//
// main
//
// execute a function in the client library to prove we can properly compile-link
//
int main(int argc, char **argv) {
printf("MySQL client version: %s\n", mysql_get_client_info());
exit(0);
}

Back to
Home
Neil Rieck
Waterloo, Ontario, Canada.