Collection Contents Index Calling stored procedures in ODBC Using ODBC without the driver manager pdf/chap4.pdf

Programming Interfaces Guide
   CHAPTER 4. ODBC Programming     

A sample program


A sample ODBC program, odbc.c, is supplied in the cxmp subdirectory of the Adaptive Server Anywhere installation directory. The program performs the same actions as the Embedded SQL dynamic cursor example program.

For Info     For a description of the associated Embedded SQL program, see Database examples.

Building the sample program 

Along with the sample program is a batch file, makeall.bat, that can be used to compile the sample program for the various environments and compilers supported by Adaptive Server Anywhere. For OS/2 the command is makeall.cmd. For QNX, use the shell script makeall. The format of the command is as follows:

makeall odbc {Platform} {Compiler}

The first parameter is odbc, meaning compile the ODBC example. The same batch file also compiles the Embedded SQL programs.

The second parameter is the platform in which the program will be run. The platform can be one of:

The third parameter is the compiler to use to compile the program. The compiler can be one of:

Building the sample program as an NT service 

The example program odbc.c, when compiled for Windows NT, runs optionally as a service.

The two files containing the example code for NT services are the source file ntsvc.c and the header file ntsvc.h. The code allows the linked executable to be run either as a regular executable or as an NT service.

  To run the compiled example as a Windows NT service:
  1. Start Sybase Central and open the Services folder.

  2. Click Add Service. Follow the instructions for adding the sample program as a service.

  3. Right-click the service icon and click Start to start the service.

When run as a service, the program displays the normal user interface if possible. It also writes the output to the Application Event Log. If it is not possible to start the user interface, the program prints one page of data to the Application Event Log and stops.

This example has been tested with the Watcom C/C++ 10.5 compiler and the Microsoft Visual C++ 2.0 compiler.


Collection Contents Index Calling stored procedures in ODBC Using ODBC without the driver manager pdf/chap4.pdf