home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------*/
- /* */
- /* Example of sqlclf() : Change server activity log file */
- /* */
- /*----------------------------------------------------------------*/
-
- #include "stdio.h"
- #include "sql.h"
- #include "errsql.h"
- #include "sqlsrv.h"
-
- /* error defines */
- #define APIERROR 1
-
- #define apierr(a) error(a,__LINE__, APIERROR)
-
- SQLTRCD rcd; /* return code */
-
- main()
- {
- SQLTSVH shandle;
- SQLTDAP srvname;
- char *password;
- char *logfile;
- int startflag;
-
- srvname = "SERVER1";
- password = 0;
- startflag = 1;
- logfile = "ACTIVITY.LOG";
-
- /* CONNECT TO THE SERVER */
-
- if (rcd = sqlcsv(&shandle,srvname,password))
- apierr("SQLCSV");
- else
- printf("Connection Established to Server \n");
-
- /* Changing activity log file */
-
- printf("change activity log file to %s\n", logfile);
- if (rcd = sqlclf(shandle,logfile,startflag))
- apierr("SQLCLF");
- else
- printf("Successful change and start of server activity log file\n");
-
- /* DISCONNECT FROM THE SERVER */
-
- if (rcd = sqldsv(shandle))
- apierr("SQLDSV");
- else
- printf("Disconnected from Server \n");
- }
-
- /*
- ERROR - prints an error message for the utility
- */
- error(what, line, type)
- char* what; /* description of what happened */
- int line; /* line number where error occured */
- int type; /* type of error */
- {
- char msg[200]; /* error message buffer */
-
- sqlerr(rcd, msg); /* get the error message */
- printf("\nError: %s at line %d: %s, Error # %d\n", what, line, msg,rcd);
- }
-
-
-