/*******************************************************************************
**
** Source File Name = restart.c 1.2
**
** Licensed Materials - Property of IBM
**
** (C) COPYRIGHT International Business Machines Corp. 1995, 1999
** All Rights Reserved.
**
** US Government Users Restricted Rights - Use, duplication or
** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
**
**
** PURPOSE : to restart a database when it has been abnormally terminated
**
** APIs USED :
** RESTART DATABASE sqlerstd
**
** STRUCTURES USED :
** sqlca
**
** OTHER FUNCTIONS USED :
** external :
** check_error : Checks for SQLCODE error, and prints out any
** [in util.c] related information available.
** This procedure is located in the util.c file.
**
** EXTERNAL DEPENDENCIES :
** - Ensure existence of database for precompile purposes.
** - Compile and link with the IBM Cset++ compiler (AIX and OS/2)
** or the Microsoft Visual C++ compiler (Windows)
** or the compiler supported on your platform.
**
** For more information about these samples see the README file.
**
** For more information on programming in C, see the:
** - "Programming in C and C++" section of the Application Development Guide
** For more information on Building C Applications, see the:
** - "Building C Applications" section of the Application Building Guide.
**
** For more information on the SQL language see the SQL Reference.
**
*******************************************************************************/
#include <stdio.h>
#include <sqlenv.h>
#include <sqlca.h>
#include "util.h"
#define CHECKERR(CE_STR) if (check_error (CE_STR, &sqlca) != 0) return 1;
int main (int argc, char *argv[]) {
struct sqlca sqlca;
if (argc != 4) {
printf ("USAGE : restart dbname userid passwd\n");
return 1;
} /* endif */
/*****************************\
* RESTART DATABASE API called *
\*****************************/
sqlerstd (argv[1], argv[2], argv[3], &sqlca);
CHECKERR ("RESTART DATABASE");
printf ("The database has been successfully RESTARTED\n");
}