4.2 JDBC APPLICATION FUNDAMENTALS As we discussed in Section 3.1 in Chapter 3, to run a Java database application to perform data actions against the selected database, the JDBC API
Category: Executing Statements
Using the Driver.connect() Method – JDBC Applications and Design ConsiderationsUsing the Driver.connect() Method – JDBC Applications and Design Considerations
4.2.2.3 Using the Driver.connect() Method The Driver.connect() method enables you to create an actual connection to the desired data-base and returns an associated Connection object. This method accepts the database
Using the Statement Object – JDBC Applications and Design ConsiderationsUsing the Statement Object – JDBC Applications and Design Considerations
4.2.3.2 Using the Statement Object As we discussed in the last section, three separate statement objects can be created based on three different data actions: Statement, PreparedStatement and CallableStatement. Let’s
Creating the CallableStatement Object – JDBC Applications and Design ConsiderationsCreating the CallableStatement Object – JDBC Applications and Design Considerations
4.2.3.4.2 Creating the CallableStatement Object To create a CallableStatement object, you need to use one of methods defined in the Connection class (refer to Table 4.3), prepareCall(). When SQL92 syntax
Executing the CallableStatement Object 2 – JDBC Applications and Design ConsiderationsExecuting the CallableStatement Object 2 – JDBC Applications and Design Considerations
Generally, the execute methods can be divided into two categories: 1) execute methods that need to perform a data query, such as executeQuery(), which returns an instance of ResultSet that
Executing the CallableStatement Object – JDBC Applications and Design ConsiderationsExecuting the CallableStatement Object – JDBC Applications and Design Considerations
4.2.3.4.5 Executing the CallableStatement Object To run a CallableStatement object, three execution methods can be used: executeQuery(), executeUpdate() and execute(). As we discussed in Section 4.2.3.1, the executeQuery() method can
The ResultSet Interface – JDBC Applications and Design ConsiderationsThe ResultSet Interface – JDBC Applications and Design Considerations
4.2.4.1 The ResultSet Interface Data is stored in a ResultSet just as it is returned by the database: it is stored in tabular format. Each field of the database can
Getting and Processing the ResultSet Object 2 – JDBC Applications and Design ConsiderationsGetting and Processing the ResultSet Object 2 – JDBC Applications and Design Considerations
Figure 4.15a shows an initial cursor position of a ResultSet object in which an execution method has just completed and a ResultSet object is created. The cursor now points to
Getting and Processing the ResultSet Object – JDBC Applications and Design ConsiderationsGetting and Processing the ResultSet Object – JDBC Applications and Design Considerations
4.2.4.2 Getting and Processing the ResultSet Object When an Oracle data query is executed, the returned result is stored in a ResultSet object, and this ResultSet object can be created
Using the DatabaseMetaData Interface – JDBC Applications and Design ConsiderationsUsing the DatabaseMetaData Interface – JDBC Applications and Design Considerations
4.2.5.2 Using the DatabaseMetaData Interface Compared with other metadata interfaces, the DatabaseMetaData is the largest, with over 150 methods. This interface is mainly used by developers who are building database