Java Reference
In-Depth Information
Note You will receive a compile-time warning when using FilteredRowSetIm-
pl because it is an internal SUN proprietary API.
Notice that the filter has not yet been applied. Actually, at this point what you have
is a scrollable RowSet that is populated with all the results from the query. The ex-
ample displays those results before applying the filter. To apply the filter, use the
setFilter() method, passing the filter as an argument. Once that has been done,
the FilteredResultSet will display only those rows that match the criteria speci-
fied by the filter.
Again, the FilteredRowSet technique has its place, especially when you are
working with an application that might not always be connected to a database. It is a
powerful tool to use for filtering data, working with it, and then applying different fil-
ters and working on the new results. It is similar to applying WHERE clauses to a query
without querying the database.
13-13. Querying and Storing Large Ob-
jects
Problem
The application that you are developing requires the storage of strings of text that can
include an unlimited number of characters.
Solution
It is best to use a character large object ( CLOB ) data type to store text when the size of
the strings that need to be stored is very large. The code in the following example
demonstrates how to load a CLOB into the database and how to query it:
package org.java8recipes.chapter13.recipe13_13;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.PreparedStatement;
Search WWH ::




Custom Search