To build the sample program clisampl:
clibld
The result is an executable file clisampl. You can run the executable file to see how it works. The sample program accepts command line arguments for a database, user ID, and password so you can connect to any database to which you have access.
To run the sample program, enter:
clisampl database userid password
where
If you need information about cataloging databases, or about SYSADM authority and passwords, refer to the Quick Beginnings book for your platform.
The clisampl program performs the following SQL operations using DB2 CLI function calls:
You should see the following output:
Connecting Create table - CREATE TABLE CLISAMPL (COL1 VARCHAR(50)) Insert - INSERT INTO CLISAMPL VALUES (?) Select - SELECT * FROM CLISAMPL Number of columns - 1 Column name - COL1 Column type - 12 Column precision - 50 Column scale - 0 Column nullable - TRUE Column value - Row 1 Column value - Row 2 Disconnecting Exiting program