Home
Name Modified Size InfoDownloads / Week
V1_0 2011-05-12
README 2011-05-12 2.0 kB
matts_C_API_Revised_normalised.rtf 2010-10-26 4.0 kB
Totals: 3 Items   6.0 kB 0
MP MySQL C API Check.

This program was designed to start up its own light http server and when a client make a http request to the server the socket program opens a socket to a MySQL database and queries a table and returns the result to the client browser.

The purpose of the program was to allow a user to be able to check database availability (not just pinging port 3306) without requiring a complete LAMP installation.

    Copyright (C) 2010 Matt Palmer <matthew.palmer@linux.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>

This program only requires a C compiler and the MySQL client libraries in order to compile on a Linux platform. It hasnt been tested on anything else.

You can compile it as follows:

gcc -o socketAPI socketAPI.c -I /usr/local/mysql5/include/mysql -L /usr/local/mysql5/lib/mysql -lmysqlclient -lz

The .c file has a section where the user is required to enter the hostname,database user,passwowrd and the required SELECT statement to be run.

Once compiled the program asks for one set of arguments (the port number for the TCP server to listen on). 

Future versions will feature additional arguments to allow a user to specify the database query either as an argument or an additional parameter in the client URL calling the program.

Hope you find it useful, I'm looking for people to join the project to make it better, any volunteers - send me a mail.

Thanks

Matt

Source: README, updated 2011-05-12