Submitting SQL statements to Db2
You can use several different methods to submit SQL statements to Db2 interactively or through application programs.
You can issue SQL statements interactively from a keyboard at a terminal or through a terminal emulator, or by using various developer and administrator tools.
SQL statements can also be issued through application programs. The application programs can contain SQL statements that are statically embedded in the application. Alternatively, application programs can create their SQL statements dynamically, such as in response to information that a user provides by filling in a form. The method of preparing an SQL statement for execution and the persistence of its operational form distinguish static SQL from dynamic SQL.
- Interactive SQL
- Interactive SQL refers to SQL statements that you submit to Db2 by using SPUFI (SQL processor using file input), the Db2 command line processor, or developer tools such as IBM® Db2 for z/OS® Developer Extension and Db2 Query Management Facility (QMF). For more information, see the following topics:
- Static SQL
- The source form of a static SQL statement is embedded within an application program written in a host language such as COBOL. The statement is prepared before the program is executed and the operational form of the statement persists beyond the execution of the program. For more information, see the following topics: .
- Dynamic SQL
- You can use dynamic SQL when you do not know the content of an SQL statement when you write a program or before you run it. You can issue dynamic SQL statements in interactively, by embedding the SQL statements in application programs. For more information, see the following topics:
- Db2 for z/OS ODBC
- Db2 for z/OS ODBC ODBC (Open Database Connectivity) is an application programming interface (API) that enables C and C++ application programs to access relational databases. The ODBC interface offers an alternative to using embedded static SQL and a different way of performing dynamic SQL. Through the interface, an application invokes a C function at execution time to connect to a data source, to dynamically issue SQL statements, and to retrieve data and status information. For more information, see the following topics:
- Db2 access for Java: SQLJ, JDBC and pureQuery
- SQLJ, JDBC, and pureQuery are methods for accessing Db2 data from applications that are written in the Java programming language. In general, Java applications use SQLJ for static SQL, and they use JDBC for dynamic SQL. IBM pureQuery provides benefits to both static and dynamic SQL.
For more information, see: