Databases Reference
In-Depth Information
while(rs.next())
{
com.ibm.db2.jcc.DB2Xml data=(com.ibm.db2.jcc.DB2Xml)
rs.getObject(1);
// Print the result as DB2 XML String
System.out.println();
System.out.println(data.getDB2String());
}
// Close the result set
rs.close();
The metadata information regarding the XML data type column gives the data
type of the column as java.sql.Types.OTHER because there is no XML data
type defined in the JDBC standard.
5.7 Simple application program life cycle
Figure 5-1 on page 226 shows different life cycles for a query in an application
program. An application program starts by getting the Connection object for the
database using DriverManager. A Connection object can be used to create three
different kinds of SQL statements: Statement, PreparedStatement, and
CallableStatements. Connection objects provide methods to create any of these
objects. A Statement object is used to execute the SQL statement with a
parameter, and the PreparedStatement can be used to run the SQL statement
with a parameter. CallableStatement is used to call the user defined functions
(UDFs). Figure 5-1 depicts different paths for an SQL statement in a JDBC
program.
Search WWH ::




Custom Search