OpenVMS Source-Code Demos

mysql_demo01

//==============================================================================
// title       : mysql_demo01.c
// author      : Neil Rieck ( http://neilrieck.net MAILTO:n.rieck@sympatico.ca )
//             : Waterloo, Ontario, Canada.
// created     : 2014-01-27
// purpose     : a 'hello world' program for MariaDB (an alternative fork of MySQL)
// target      : for MariaDB-5.5.25 on OpenVMS-8.4
// vms-build   : @mysql_demo.com mysql_demo1.c (see mysql_demo.com for details)
// caveat      : Linking is noisy on Alpha but not Itanium
// dependancies: you need an up-to-date version of zlib (1.2.6 or higher). I used
//		 this one:
//			http://fafner.dyndns.org/~alexey/libsdl/ZLIB-1_2_7.ZIP
// 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);
}

left hand Back to OpenVMS
left hand Back to OpenVMS Demo Index
home Back to Home
Neil Rieck
Kitchener - Waterloo - Cambridge, Ontario, Canada.