Archive for October, 2011

Using RowCallbackHandler in Spring JdbcTemplate

CallbackHandler is a interface used by JdbcTemplate’s query methods. This interface cantains only one method with the signature in the following code snippet. The implementation class of this interface needs to implements the processRow() method, which take responsibility to process each row of data in the ResultSet. The processRow() method should not call next()...

Full story

Using ResultSetExcractor in Spring JdbcTemplate

JdbcTemplate class includes query methods to prepare and execute the SQL queries. The Spring JDBC abstraction framewor provides three different types of callbacks to read the results after executing the SQL query using query() methods. ResultSetExtractor RowCallbackHandler RowMapper Let’s start our discussion with ResultSetExtractor. ResultSetExtractor contains only one method with the regnature shown in...

Full story

JdbcTemplate to execute SQL DML Statements

JdbcTemplate proveides update() methods for executing single SQL DML statement. It support JDBC statement and PreparedStatement style of eecuting the SQL statements. Following example demonstrates all the update methods of JdbcTemplate. To make this example simple, we are using ‘Product’ table. Following SQL Script show the table description. Following Dao Interface shows the minimum...

Full story

JDBC ResultSet Metadata using Oracle

In the simplest meaning, metadata is data about data.When you apply this to database, metadata is information about database data, or about table data. Examples of metadata are descriptions of the tables and column attributes, column type etc The JDBC API enables you to uncover metadata about a database and a query’s result set...

Full story

Using JDBC Database Metadata

The java.sql.DatabaseMetaData is an interface implemented by the JDBC driver provired. The DatabaseMetaData interface encapsulate all the information related to the database and driver. Using this interface, you can get more detail information about database, all the table in the database, catalog name, table type (view, table, system table, synonym ) etc. Creating DatabaseMetaData...

Full story

Oracle WebRowSet Tutorial using JDBC

The WebRowSet class extends the CachedRowSet class, which lets you use the same properties and methods as well as operate in disconnected mode. However, the WebRowSet object can generate XML documents representing itself. You can use these documents to create copies of the WebRowSet object, which makes it easy for you to distribute the...

Full story

Oracle CachedRowSet Tutorial with JDBC

The CachedRowSet class provides the same functionality as the JdbcRowSet class, with one important difference: a CachedRowSet object can operate in a disconnected environment. As a result, it can function without a JDBC driver present. Once you populate a CachedRowSet object with data you may send it over the network to thin clients (PDA’s...

Full story

Working with JdbcRowSet Object

The JdbcRowSet class provides a basic implementation of the javax.sql.RowSet interface, which turns a ResultSet object into a JavaBean and abstracts the details of working with ResultSet objects. You can use this object to simplify connection steps or to provide scrollable and updateable cursors for drivers that do not support these features. However, JdbcRowSet...

Full story

Reading Oracle Struct Object Using JDBC getObject()

In Our last tutorial, Inserting Struct Object data Using JDBC i explain how to create a user-defined-type (Struct) using Oracle. We also see how to insert your own java object in that UDT. Now using the same tutorial, just we are going to see how you can read that UDT using PreparedStatement’s getObject() method....

Full story

Inserting Oracle Struct Object Using JDBC

JDBC 3.0 specification includes support for User-Defined-Type (UDT) by providing various methods in the PreparedStatement, CallableStatement and ResultSet interface. Most of the database now enable you to create structured types, used todefine complex data types. This is required in case you want to create a user-defined-type (UDT) in a database. For example, you migth...

Full story

Copyright © 2013 JDBC Tutorial. All rights reserved.
Proudly powered by WordPress. Developed by 7tech Solutions