The steps involved in building a C/C++ application with embedded SQL are:
For our example, assume we finished our C inventory program named inventory.sqc on a Windows system using Visual C++. To precompile the program, we can run the following statement shown in Example
Example Output from running the PREP command
This will produce a modified source file named inventory.c and a package in the database.
Alternatively, we can create a bind file and later bind the file to manually create a package. This is known as deferred binding. We can accomplish this by using the BINDFILE option in the PRECOMPILE command.
Basic statements to create a bind file and package
After precompiling, we need to compile the modified source file. We can do this on the Windows system by running the command:cl -Zi -Od -c -W2 inventory.c
This produces an object file named inventory.obj. We can then create an executable file named inventory.exe by running the command:link -debug -out:inventory.exe inventory.obj db2api.lib
Depending on your compiler and the options you set, the commands for compiling and linking will be different.
Host variables and parameter markers
In a static SQL statement, the complete SQL statement along with the type and length of the data requested is known at precompile time. The only missing information is the actual data values for the SQL statement. Acting as placeholders for the missing data, host variables need to be defined by the application to represent the remaining information in the SQL statement. Host variables are represented by prefixing a colon (:) in front of the variable name.
For a dynamic SQL statement, parameter markers are represented as a question mark (?) for any variable information in an SQL statement.
IBM DB2 Related Interview Questions
|IBM Websphere Interview Questions||IBM-REXX Interview Questions|
|IBM Cognos Interview Questions||IBM DB2 Interview Questions|
|J2EE Interview Questions||COBOL Interview Questions|
|IBM-JCL Interview Questions||DB2 Using SQL Interview Questions|
|IBM WAS Administration Interview Questions||IBM WebSphere Administration Interview Questions|
|Database Administration Interview Questions||DB2 SQL Programming Interview Questions|
|Mainframe DB2 Interview Questions|
IBM DB2 Related Practice Tests
|IBM Websphere Practice Tests||IBM Cognos Practice Tests|
|IBM DB2 Practice Tests||J2EE Practice Tests|
|COBOL Practice Tests||IBM-JCL Practice Tests|
|DB2 Using SQL Practice Tests||IBM WAS Administration Practice Tests|
|Database Administration Practice Tests||DB2 SQL Programming Practice Tests|
Ibm Db2 Tutorial
Db2 Application Development Overview
Application Development With Db2 Purexml
Application Development With Php
Application Development With C/c++
Application Development With Java
Application Development With .net
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.