Problem: I am trying to get the example programs to work, and am having a difficult time. Can you help me out? Solution: Note: The information in this document was tested under InterBase version 5.5 and Borland C++ 5.02. There are a couple of known problems with our example programs. This document will help you to overcome those difficulties and run our example programs. In addition to this document, please read the readme file that is located in the ...interbaseexamplesapi directory. It will tell you what each example program is demonstrating, as well as giving you some additional set up information. Listed below are some workarounds to known difficulties with InterBase's example programs. 1. Before running dyn1.e example, delete any files called "new.gdb" from the directory where you will place your executable. The example "dyn1.e" creates a database called "new.gdb" on the fly. If a database by that name already exists, you will get a "-901" error, because the database already exists. 2. dyn1.e will not work if you try to compile the code that gpre generates into a .c file. You will need to edit the .c file that gpre creates. The line that creates the new.gdb database will need to be editted to remove reference to the database handle to employee.gdb. The database handle variables need to be replaced them with references to null database handles. Failing to do this will result in a -904 error when you compile and run the resulting executable. Here is the modification needed to make this example work: db = NULL; // this was changed to NULL from employee.gdb /* * Create a new database, establishing a connection * as well. */ // this block of code was re - done after the the gpre preprocessing // to make it work: /*EXEC SQL EXECUTE IMMEDIATE "CREATE DATABASE 'new.gdb'";*/ { isc_embed_dsql_execute_immed (isc_status, &db, &gds__trans, 0, "CREATE DATABASE 'new.gdb'", 1, (XSQLDA*) 0L); SQLCODE = isc_sqlcode (isc_status); } 3. stat1.e will not work until you include a .def file in your project that imports more code into the project. a. Create a text file called stat1.def that contains the next two lines of code: IMPORTS _isc_start_transaction = GDS32.isc_start_transaction b. Add the stat1.def file to the project. a. Select View | Project from the Borland C++ menu. b. right click on the stat1.exe in the project viewer. c. click on "Add Node" d. select stat1.def as the file you wish to add. 4. Another thing you may notice when you run the example programs is that the compiler may complain about not having a prototype for the function printf. If you see such an error, add this line to your program: #include5. In order to get example programs api13.c and api16.c to work, you will need to do the following steps: a. gbak employee.gdb file b. restore the employee.gdb sample database to employe2.gdb . c. Add the table CROSS_RATE to employe2.gdb. Listed below is the command to do this: create table CROSS_RATE (country varchar(30), from_currency double precision, to_currency double precision) d. File | Commit work in WISQL to commit the table to the database. e. After creating the table, you can now compile and run api13.c 6. Make sure your system has a user account called "guest" before running the api14 and winevent examples.
Last Modified: 23-OCT-00