[JAVA][JDBC RowSet Implementations Tutorial].pdf

(212 KB) Pobierz
JDBC
TM
RowSet Implementations Tutorial
Maydene Fisher with contributions from
Jonathan Bruce, Amit Handa & Shreyas Kaushik
Sun Microsystems Inc.
4150 Network Circle
Santa Clara, CA 95054
USA
Revision 1.0
Send comments to jdbc@sun.com
1
5
RowSet Overview 5
What Can RowSet Objects Do?
Function as a JavaBeans™ Component 6
Properties 6
Event Notification 7
Add Scrollability or Updatability 8
Kinds of RowSet Objects
Connected RowSet Objects 8
Disconnected RowSet Objects 8
5
8
11
JdbcRowSet 11
Creating a JdbcRowSet Object
Passing a ResultSet Object 12
Using the Default Constructor 13
Setting Properties 14
Setting Parameters for the Command 15
Using a JdbcRowSet Object
Navigating a JdbcRowSet Object 17
Updating a Column Value 18
Inserting a Row 18
Deleting a Row 19
Code Sample
11
16
20
23
CachedRowSet 23
Setting Up a CachedRowSet Object
Creating a CachedRowSet Object 24
Using the Default Constructor 24
Passing a SyncProvider Implementation 24
Setting Properties 25
Setting Key Columns 26
Populating a CachedRowSet Object
What a Reader Does 27
Updating a CachedRowSet Object
Updating a Column Value 29
Inserting and Deleting Rows 29
Updating the Data Source
What a Writer Does 30
Using the Default Implementation 31
Using a SyncResolver Object 31
Using Other SyncProvider Implementations 33
23
26
28
30
2
Notifying Listeners
Setting Up Listeners 34
How Notification Works 35
Accessing Large Amounts of Data
Code Sample
34
35
37
43
JoinRowSet 43
Creating a JoinRowSet Object
Adding RowSet Objects
Passing the Match Column to addRowSet 46
Using Joinable.setMatchColumn 47
Using Multiple Columns as the MatchColumn 47
Using a JoinRowSet Object
Code Sample
43
44
48
49
53
FilteredRowSet 53
Creating a Predicate Object
Creating a FilteredRowSet Object 58
Creating and Setting a Predicate Object 59
Working with Filters
Updating a FilteredRowSet Object
Inserting or Updating a Row 62
Deleting a Row 63
Combining Two Filters into One 64
Code Samples
Code Sample 1 65
Code Sample 2 71
Code Sample 3 76
54
60
62
65
81
WebRowSet 81
Creating and Populating a WebRowSet Object
Writing and Reading a WebRowSet Object to XML 83
Using the writeXml Method 83
Using the readXml Method 84
What Is in the XML Document
Properties 86
Metadata 87
Data 88
Making Changes to a WebRowSet Object
Inserting a Row 90
Deleting a Row 91
82
84
90
3
Modifying a Row 91
WebRowSet Code Example
WebRowSet XML Schema
92
95
4
Zgłoś jeśli naruszono regulamin