EasyManuals Logo

IBM DB2 User Manual

IBM DB2
585 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #40 background imageLoading...
Page #40 background image
JDBC interfaces for executing SQL
You execute SQL statements in a traditional SQL program to update data in tables,
retrieve data from the tables, or call stored procedures. To perform the same
functions in a JDBC program, you invoke methods.
Those methods are defined in the following interfaces:
v The Statement interface supports all SQL statement execution. The following
interfaces inherit methods from the Statement interface:
The PreparedStatement interface supports any SQL statement containing
input parameter markers. Parameter markers represent input variables. The
PreparedStatement interface can also be used for SQL statements with no
parameter markers.
With the IBM Data Server Driver for JDBC and SQLJ, the PreparedStatement
interface can be used to call stored procedures that have input parameters
and no output parameters, and that return no result sets. However, the
preferred interface is CallableStatement.
The CallableStatement interface supports the invocation of a stored
procedure.
The CallableStatement interface can be used to call stored procedures with
input parameters, output parameters, or input and output parameters, or no
parameters. With the IBM Data Server Driver for JDBC and SQLJ, you can
also use the Statement interface to call stored procedures, but those stored
procedures must have no parameters.
v The ResultSet interface provides access to the results that a query generates.
The ResultSet interface has the same purpose as the cursor that is used in SQL
applications in other languages.
Related concepts
“Example of a simple JDBC application” on page 7
“JDBC connection objects” on page 19
Related tasks
“Retrieving data from tables using the PreparedStatement.executeQuery
method” on page 33
“Updating data in tables using the PreparedStatement.executeUpdate method”
on page 25
“Retrieving data from tables using the Statement.executeQuery method” on
page 32
“Creating and modifying database objects using the Statement.executeUpdate
method”
Related reference
“Driver support for JDBC APIs” on page 252
Creating and modifying database objects using the
Statement.executeUpdate method
The Statement.executeUpdate is one of the JDBC methods that you can use to
update tables and call stored procedures.
You can use the Statement.executeUpdate method to do the following things:
v Execute data definition statements, such as CREATE, ALTER, DROP, GRANT,
REVOKE
24 Application Programming Guide and Reference for Java

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM DB2 and is the answer not in the manual?

IBM DB2 Specifications

General IconGeneral
DeveloperIBM
Initial Release1983
LicenseProprietary
Written inC, C++
CategoryDatabase Management System (RDBMS)
Operating SystemLinux, Windows
Programming LanguagesC, C++
Data ModelsRelational
EditionsCommunity, Standard, Advanced
Key Featureshigh availability, scalability