Muutke küpsiste eelistusi

E-raamat: Practical Database Programming with Java [Wiley Online]

(Johnson C. Smith University, Charlotte, NC)
  • Formaat: 960 pages, Charts: 200 B&W, 0 Color; Photos: 200 B&W, 0 Color; Drawings: 200 B&W, 0 Color
  • Ilmumisaeg: 21-Oct-2011
  • Kirjastus: Wiley-IEEE Press
  • ISBN-10: 111810465X
  • ISBN-13: 9781118104651
  • Wiley Online
  • Hind: 116,25 €*
  • * hind, mis tagab piiramatu üheaegsete kasutajate arvuga ligipääsu piiramatuks ajaks
  • Formaat: 960 pages, Charts: 200 B&W, 0 Color; Photos: 200 B&W, 0 Color; Drawings: 200 B&W, 0 Color
  • Ilmumisaeg: 21-Oct-2011
  • Kirjastus: Wiley-IEEE Press
  • ISBN-10: 111810465X
  • ISBN-13: 9781118104651
Covers fundamental and advanced Java database programming techniques for beginning and experienced readers This book covers the practical considerations and applications in database programming using Java NetBeans IDE, JavaServer Pages, JavaServer Faces, and Java Beans, and comes complete with authentic examples and detailed explanations.

Two data-action methods are developed and presented in this important resource. With Java Persistence API and plug-in Tools, readers are directed step by step through the entire database programming development process and will be able to design and build professional data-action projects with a few lines of code in mere minutes. The second method, runtime object, allows readers to design and build more sophisticated and practical Java database applications.

Advanced and updated Java database programming techniques such as Java Enterprise Edition development kits, Enterprise Java Beans, JavaServer Pages, JavaServer Faces, Java RowSet Object, and Java Updatable ResultSet are also discussed and implemented with numerous example projects.

Ideal for classroom and professional training use, this text also features:





A detailed introduction to NetBeans Integrated Development Environment Java web-based database programming techniques (web applications and web services) More than thirty detailed, real-life sample projects analyzed via line-by-line illustrations Problems and solutions for each chapter A wealth of supplemental material available for download from the book's ftp site, including PowerPoint slides, solution manual, JSP pages, sample image files, and sample databases Coverage of two popular database systems: SQL Server 2008 and Oracle

This book provides undergraduate and graduate students as well as database programmers and software engineers with the necessary tools to handle the database programming issues in the Java NetBeans environment.

To obtain instructor materials please send an email to: [email protected]
Preface xxiii
Acknowledgments xxv
Chapter 1 Introduction
1(8)
What This Book Covers
2(1)
How This Book Is Organized and How to Use This Book
3(2)
How to Use the Source Code and Sample Databases
5(1)
Instructor and Customer Support
6(1)
Homework Solutions
7(2)
Chapter 2 Introduction to Databases
9(80)
2.1 What Are Databases and Database Programs?
10(2)
2.1.1 File Processing System
10(1)
2.1.2 Integrated Databases
11(1)
2.2 Develop a Database
12(1)
2.3 Sample Database
13(4)
2.3.1 Relational Data Model
15(1)
2.3.2 Entity-Relationship Model
16(1)
2.4 Identifying Keys
17(1)
2.4.1 Primary Key and Entity Integrity
17(1)
2.4.2 Candidate Key
17(1)
2.4.3 Foreign Keys and Referential Integrity
17(1)
2.5 Define Relationships
18(3)
2.5.1 Connectivity
18(3)
2.6 ER Notation
21(1)
2.7 Data Normalization
21(5)
2.7.1 First Normal Form (1NF)
22(1)
2.7.2 Second Normal Form (2NF)
23(1)
2.7.3 Third Normal Form (3NF)
24(2)
2.8 Database Components in Some Popular Databases
26(8)
2.8.1 Microsoft Access Databases
26(1)
2.8.1.1 Database File
27(1)
2.8.1.2 Tables
27(1)
2.8.1.3 Queries
27(1)
2.8.2 SQL Server Databases
27(1)
2.8.2.1 Data Files
28(1)
2.8.2.2 Tables
28(1)
2.8.2.3 Views
29(1)
2.8.2.4 Stored Procedures
29(1)
2.8.2.5 Keys and Relationships
29(1)
2.8.2.6 Indexes
30(1)
2.8.2.7 Transaction Log Files
30(1)
2.8.3 Oracle Databases
30(1)
2.8.3.1 Data Files
31(1)
2.8.3.2 Tables
31(1)
2.8.3.3 Views
31(1)
2.8.3.4 Stored Procedures
31(1)
2.8.3.5 Indexes
32(1)
2.8.3.6 Initialization Parameter Files
33(1)
2.8.3.7 Control Files
33(1)
2.8.3.8 Redo log Files
33(1)
2.8.3.9 Password Files
34(1)
2.9 Create Microsoft Access Sample Database
34(10)
2.9.1 Create the LogIn Table
34(2)
2.9.2 Create the Faculty Table
36(1)
2.9.3 Create the Other Tables
37(2)
2.9.4 Create Relationships among Tables
39(5)
2.10 Create Microsoft SQL Server 2008 Sample Database
44(17)
2.10.1 Create the LogIn Table
46(2)
2.10.2 Create the Faculty Table
48(1)
2.10.3 Create Other Tables
49(5)
2.10.4 Create Relationships among Tables
54(1)
2.10.4.1 Create Relationship between the LogIn and the Faculty Tables
54(3)
2.10.4.2 Create Relationship between the LogIn and the Student Tables
57(1)
2.10.4.3 Create Relationship between the Faculty and the Course Tables
58(1)
2.10.4.4 Create Relationship between the Student and the StudentCourse Tables
59(1)
2.10.4.5 Create Relationship between the Course and the StudentCourse Tables
60(1)
2.11 Create Oracle 10g XE Sample Database
61(24)
2.11.1 Create an Oracle User Database
63(1)
2.11.2 Add New Data Tables into the Oracle User Database
64(1)
2.11.2.1 Create the LogIn Table
65(4)
2.11.2.2 Create the Faculty Table
69(5)
2.11.2.3 Create Other Tables
74(3)
2.11.3 Create the Constraints Between Tables
77(1)
2.11.3.1 Create the Constraints between the LogIn and Faculty Tables
77(2)
2.11.3.2 Create the Constraints between the LogIn and Student Tables
79(1)
2.11.3.3 Create the Constraints between the Course and Faculty Tables
80(2)
2.11.3.4 Create the Constraints between the StudentCourse and Student Tables
82(1)
2.11.3.5 Create the Constraints between the StudentCourse and Course Tables
82(3)
2.12
Chapter Summary
85(4)
Homework
85(4)
Chapter 3 JDBC API and JDBC Drivers
89(24)
3.1 What Are JDBC and JDBC API?
89(1)
3.2 JDBC Components and Architecture
90(2)
3.3 How Does JDBC Work?
92(3)
3.3.1 Establish a Connection
92(1)
3.3.1.1 Using DriverManager to Establish a Connection
92(1)
3.3.1.2 Using DataSource Object to Establish a Connection
93(1)
3.3.2 Build and Execute SQL Statements
94(1)
3.3.3 Process Results
94(1)
3.3.3.1 Using ResultSet Object
95(1)
3.3.3.2 Using RowSet Object
95(1)
3.4 JDBC Driver and Driver Types
95(4)
3.4.1 Type I: JDBC-ODBC Bridge Driver
96(1)
3.4.2 Type II: Native-API-Partly-Java Driver
97(1)
3.4.3 Type III: JDBC-Net-All-Java Driver
97(1)
3.4.4 Type IV: Native-Protocol-All-Java Driver
98(1)
3.5 JDBC Standard Extension API
99(9)
3.5.1 JDBC DataSource
99(1)
3.5.1.1 Java Naming and Directory Interface
100(1)
3.5.1.2 Deploy and Use a Basic Implementation of DataSource
100(2)
3.5.2 JDBC Driver-Based Connection Pooling
102(2)
3.5.3 Distributed Transactions
104(1)
3.5.3.1 Distributed Transaction Components and Scenarios
104(1)
3.5.3.2 The Distributed Transaction Process
105(1)
3.5.4 JDBC RowSet
106(1)
3.5.4.1 Introduction to Java RowSet Object
106(1)
3.5.4.2 Implementation Process of a RowSet Object
107(1)
3.6
Chapter Summary
108(5)
Homework
109(4)
Chapter 4 JDBC Application Design Considerations
113(42)
4.1 JDBC Application Models
113(2)
4.1.1 Two-Tier Client-Server Model
113(1)
4.1.2 Three-Tier Client-Server Model
114(1)
4.2 JDBC Applications Fundamentals
115(36)
4.2.1 Loading and Registering Drivers
116(1)
4.2.2 Getting Connected
117(1)
4.2.2.1 The DriverManager and Driver Classes
117(2)
4.2.2.2 Using the DriverManager.getConnection() Method
119(1)
4.2.2.3 Using the Driver.connect() Method
119(1)
4.2.2.4 The JDBC Connection URL
120(1)
4.2.2.5 Establish a Database Connection
120(2)
4.2.3 Executing Statements
122(1)
4.2.3.1 Overview of Statement Objects and Their Execution Methods
123(3)
4.2.3.2 Using the Statement Object
126(1)
4.2.3.3 Using the PreparedStatement Object
127(4)
4.2.3.4 Using the CallableStatement Object
131(4)
4.2.3.5 More about the Execution Methods
135(2)
4.2.3.6 Creating and Executing SQL Statements
137(3)
4.2.4 Retrieving Results
140(1)
4.2.4.1 The ResultSet Interface
141(1)
4.2.4.2 Getting and Processing the ResultSet Object
142(3)
4.2.5 Using JDBC MetaData Interfaces
145(1)
4.2.5.1 Using the ResultSetMetaData Interface
145(2)
4.2.5.2 Using the DatabaseMetaData Interface
147(2)
4.2.5.3 Using the ParameterMetaData Interface
149(1)
4.2.6 Closing the Connection and Statements
149(2)
4.3
Chapter Summary
151(4)
Homework
152(3)
Chapter 5 Introduction to NetBeans IDE
155(162)
5.1 Overview of the NetBeans IDE 6.8
156(5)
5.1.1 The NetBeans Platform
158(1)
5.1.2 The NetBeans Open Source IDE
159(2)
5.2 Installing and Configuring the NetBeans IDE 6.8
161(3)
5.3 Exploring NetBeans IDE 6.8
164(148)
5.3.1 An Overview of NetBeans IDE 6.8 GUI
165(2)
5.3.2 Build a New Java Project
167(1)
5.3.2.1 Build a Java Application Project
168(10)
5.3.2.2 Build a Java Desktop Application
178(5)
5.3.2.3 Build a Java Class Library
183(8)
5.3.2.4 Build a Java Project with Existing Sources
191(1)
5.3.2.5 Build a Java Free-Form Project
192(1)
5.3.3 Build a JavaFX Application Project
193(1)
5.3.3.1 Overview of JavaFX
193(1)
5.3.3.2 JavaFX SDK
194(1)
5.3.3.3 JavaFX Script Language
195(1)
5.3.3.4 Build a JavaFX Script Application
195(6)
5.3.3.5 Build a JavaFX Desktop Business Application
201(13)
5.3.3.6 Build JavaFX Mobile Business Application
214(1)
5.3.4 Build a Java Web Application Project
214(1)
5.3.5 Build a Java Enterprise Edition Project
214(1)
5.3.5.1 Overview of Java Enterprise Edition 6
215(7)
5.3.5.2 Install and Configure Java EE 6 Software and Tools
222(2)
5.3.5.3 Create a Java EE 6 Web Application Project
224(3)
5.3.5.4 Creating the Entity Classes from the Database
227(2)
5.3.5.5 Creating Enterprise Java Beans
229(3)
5.3.5.6 Using JavaServer Faces (JSF) 2.0
232(2)
5.3.5.7 Creating the Manufacturer Managed Bean
234(1)
5.3.5.8 Creating the Manufacturer Listing Web Page
235(3)
5.3.5.9 Building and Running the First Java EE 6 Web Page
238(1)
5.3.5.10 Deploying the Project Using the Administration Console
239(2)
5.3.5.11 Creating the Manufacturer Details Web Page
241(1)
5.3.5.12 Creating and Editing the faces-config.xml Configuration File
242(5)
5.3.5.13 Editing the General Web Application Configuration File web.xml
247(1)
5.3.5.14 Modifying the JSF Pages to Perform Page Switching
248(1)
5.3.5.15 Building and Running the Entire Java EE 6 Project
249(2)
5.3.6 Build a Maven Project
251(1)
5.3.6.1 Introduction to Maven
251(2)
5.3.6.2 Introduction to Hibernate Framework
253(2)
5.3.6.3 Installing and Configuring the Apache Maven
255(3)
5.3.6.4 Configuring Maven Inside the NetBeans IDE
258(1)
5.3.6.5 Creating a Maven Database Application Project
259(2)
5.3.6.6 Adding Hibernate Files and Dependencies
261(4)
5.3.6.7 Generating Hibernate Mapping Files and Java Classes
265(3)
5.3.6.8 Creating the Application GUI
268(2)
5.3.6.9 Creating the Query in the HQL Query Editor
270(2)
5.3.6.10 Adding the Query to the GUI Form
272(4)
5.3.7 Build a PHP Project
276(1)
5.3.7.1 Introduction to PHP
276(1)
5.3.7.2 Downloading and Installing Apache HTTP Web Server
277(2)
5.3.7.3 Configuring and Testing the Installed Apache HTTP Web Server
279(1)
5.3.7.4 Downloading and Installing the PHP Engine
280(1)
5.3.7.5 Testing the Installed PHP Engine
281(2)
5.3.7.6 Creating a PHP Project
283(2)
5.3.7.7 Downloading and Configuring MySQL Database Server
285(3)
5.3.7.8 Configuring the MySQL Server in NetBeans IDE
288(2)
5.3.7.9 Creating Our Sample Database MySQLSample
290(3)
5.3.7.10 Building the Functions for the PHP Project
293(4)
5.3.7.11 Running and Testing the PHP Project
297(2)
5.3.8 Build a NetBeans Module
299(1)
5.3.8.1 Create a New NetBeans Module Project
300(1)
5.3.8.2 Create the Customer Entity Class and Wrap It into a Module
301(2)
5.3.8.3 Create Other Related Modules
303(3)
5.3.8.4 Create the User Interface Module
306(3)
5.3.8.5 Set Dependencies between Modules
309(2)
5.3.8.6 Build and Run the NetBeans Module Project
311(1)
5.4
Chapter Summary
312(5)
Homework
313(4)
PART I Building Two-Tier Client-Server Applications
317(238)
Chapter 6 Query Data from Databases
319(144)
Section I Query Data Using Java Persistence API Wizards
319(1)
6.1 Java Persistence APIs
319(2)
6.1.1 Features of JPA
320(1)
6.1.2 Advantages of JPA
320(1)
6.1.3 Architecture and Function of JPA
320(1)
6.2 Query Data Using Java Persistence API Wizards (JPA)
321(62)
6.2.1 Connect to Different Databases and Drivers Using JPA Wizards
322(1)
6.2.1.1 Connect to the Microsoft Access Database CSE_DEPT
322(1)
6.2.1.2 Connect to the Microsoft SQL Server 2008 Express Database CSE_DEPT
323(10)
6.2.1.3 Connect to the Oracle Database 10g Express Edition CSE_DEPT
333(5)
6.2.2 Create a Java Application Project to Query SQL Server Database
338(2)
6.2.3 Use Java JPA Wizards to Query the LogIn Table
340(1)
6.2.4 Use Java Persistence API to Build Entity Classes from Databases
341(3)
6.2.5 Add LogIn Entity Manager and JPA Components into the Project
344(1)
6.2.5.1 Entity Classes Mapping Files
345(1)
6.2.5.2 Use Java Persistence Query Language Statement
346(1)
6.2.5.3 Static and Dynamic JPA Query API
346(2)
6.2.5.4 Positional Parameters and Named Parameters
348(1)
6.2.5.5 Use Entity Classes to Build a Query to Perform the Login Process
349(2)
6.2.5.6 Use a JDialog as a MessageBox
351(3)
6.2.6 Use Java JPA Wizards to Create Selection Window
354(1)
6.2.6.1 Add a New JFrame as the SelectionFrame Form
354(4)
6.2.6.2 Modify Codes to Coordinate Operations in SelectionFrame and LogInFrame
358(2)
6.2.7 Use Java JPA Wizards to Query the Faculty Table
360(1)
6.2.7.1 Create a New FacultyFrame Class and Add It into Our Project
360(2)
6.2.7.2 Add Faculty Entity Manager and JPA Components into the Project
362(1)
6.2.7.3 Use Entity Classes to Perform Data Query from the Faculty Table
363(9)
6.2.8 Use Java JPA Wizards to Query the Course Table
372(1)
6.2.8.1 Create a New CourseFrame Class and Add It into Our Project
372(1)
6.2.8.2 Add Course Entity Manager and JPA Components into the Project
373(1)
6.2.8.3 Use Entity Classes to Perform Data Query from the Course Table
374(7)
6.2.9 Use Java JPA Wizards to Query Oracle Database
381(2)
Section II Query Data Using Java Runtime Objects Method
383(1)
6.3 Introduction to Runtime Object Method
383(1)
6.4 Create a Java Application Project to Access the SQL Server Database
384(57)
6.4.1 Create Graphic User Interfaces
384(4)
6.4.2 Perform the Data Query for the LogIn Table
388(1)
6.4.2.1 Load and Register Database Drivers
389(4)
6.4.2.2 Connect to Databases and Drivers
393(1)
6.4.2.3 Create and Manage Statement Object
394(1)
6.4.2.4 Use PreparedStatement Object to Perform Dynamic Query
395(3)
6.4.2.5 Use ResultSet Object
398(1)
6.4.3 Develop the Codes for the SelectionFrame Form
399(3)
6.4.3.1 Modify Codes to Coordinate between SelectionFrame and LogInFrame
402(1)
6.4.4 Perform the Data Query for the Faculty Table
403(1)
6.4.4.1 Add Java Package and Coding for the Constructor
403(1)
6.4.4.2 Query Data using JDBC MetaData Interface
404(6)
6.4.4.3 Query Data Using the execute() Method to Perform a Query-Related Action
410(2)
6.4.4.4 Query Data Using the CallableStatement Method
412(1)
6.4.5 Perform the Data Query for the Course Table
412(1)
6.4.5.1 Import Java Packages and Coding for the CourseFrame Constructor
413(1)
6.4.5.2 Query Data from Course Table Using CallableStatements
414(6)
6.4.5.3 Coding for the Select Button Click Event Handler to Perform CallableStatement Query
420(1)
6.4.5.4 Build the SQL Stored Procedure dbo.FacultyCourse
421(6)
6.4.5.5 Coding for the CourseList Box to Display Detailed Information for the Selected Course
427(2)
6.4.5.6 Coding for the Back Button Click Event Handler
429(1)
6.4.6 Query Data from the Student Table Using the Java RowSet Object
430(1)
6.4.6.1 Introduction to Java RowSet Object
430(2)
6.4.6.2 The Operational Procedure of Using the JDBC RowSet Object
432(1)
6.4.6.3 Build a Graphical User Interface StudentFrame Form
433(2)
6.4.6.4 Coding for the Constructor of the StudentFrame Class
435(1)
6.4.6.5 Coding for the Select Button Event Handler to Query Data Using the CachedRowSet
436(3)
6.4.6.6 Add and Display a Student Picture for the Selected Student
439(2)
6.5 Create a Java Application Project to Access the Oracle Database
441(14)
6.5.1 Create Graphic User Interfaces
442(1)
6.5.2 Perform the Data Query for the LogIn Table
442(1)
6.5.2.1 Add Oracle JDBC Driver to the Project
442(1)
6.5.2.2 Load and Register Oracle JDBC Driver
443(1)
6.5.2.3 The JDBC Uniform Resource Locators (URLs)
443(2)
6.5.3 Develop the Codes for the SelectionFrame Form
445(1)
6.5.4 Perform the Data Query for the Faculty Table
445(1)
6.5.4.1 Create an Oracle Package FacultyInfo
446(1)
6.5.4.2 Develop the Codes to Perform the CallableStatement Query
447(2)
6.5.5 Perform the Data Query for the Course Table
449(1)
6.5.5.1 Create an Oracle Package FacultyCourse
449(2)
6.5.5.2 Develop the Codes to Perform the CallableStatement Query
451(2)
6.5.6 Query Data from the Student Table Using the Java RowSet Object
453(1)
6.5.6.1 Modify the Codes in the Constructor of the StudentFrame Class
453(1)
6.5.6.2 Modify the Codes in the Select Button Click Event Handler
453(2)
6.6
Chapter Summary
455(8)
Homework
457(6)
Chapter 7 Insert, Update, and Delete Data from Databases
463(92)
Section I Insert, Update and Delete Data Using Java Persistence API Wizards
463(1)
7.1 Perform Data Manipulations to SQL Server Database Using JPA Wizards
464(18)
7.1.1 Perform Data Insertion to SQL Server Database Using JPA Wizards
464(1)
7.1.1.1 Modify the FacultyFrame Window Form
465(1)
7.1.1.2 The Persist Method in the EntityManager Class
466(2)
7.1.1.3 Develop the Codes for the Insert Button Event Handler
468(1)
7.1.1.4 Develop the Codes for the Validation of the Data Insertion
469(2)
7.1.1.5 Build and Run the Project to Test the Data Insertion
471(3)
7.1.2 Perform Data Updating to SQL Server Database Using JPA Wizards
474(1)
7.1.2.1 Develop the Codes for the Update Button Event Handler
474(2)
7.1.2.2 Build and Run the Project to Test the Data Updating
476(2)
7.1.3 Perform Data Deleting to SQL Server Database Using JPA Wizards
478(1)
7.1.3.1 Develop the Codes for the Delete Button Event Handler
478(2)
7.1.3.2 Build and Run the Project to Test the Data Deletion
480(2)
7.2 Perform Data Manipulations to Oracle Database Using JPA Wizards
482(6)
7.2.1 Perform Data Insertion to Oracle Database Using JPA Wizards
482(1)
7.2.1.1 Modify the FacultyFrame Window Form
482(1)
7.2.1.2 Develop the Codes for the Insert Button Event Handler
483(2)
7.2.2 Perform Data Updating to Oracle Database Using JPA Wizards
485(2)
7.2.3 Perform Data Deleting to Oracle Database Using JPA Wizards
487(1)
Section II Insert, Update and Delete Data Using Java Runtime Objects Method
488(1)
7.3 Perform Data Manipulations to SQL Server Database Using Java Runtime Object
488(14)
7.3.1 Perform Data Insertion to SQL Server Database Using Java Runtime Object
488(1)
7.3.1.1 Modify the FacultyFrame Window Form
489(1)
7.3.1.2 Develop the Codes for the Insert Button Event Handler
490(2)
7.3.1.3 Develop the Codes for the Validation of the Data Insertion
492(1)
7.3.1.4 Build and Run the Project to Test the Data Insertion
493(3)
7.3.2 Perform Data Updating to SQL Server Database Using Java Runtime Object
496(1)
7.3.2.1 Develop the Codes for the Update Button Event Handler
496(1)
7.3.2.2 Build and Run the Project to Test the Data Updating
497(2)
7.3.3 Perform Data Deleting to SQL Server Database Using Java Runtime Object
499(1)
7.3.3.1 Develop the Codes for the Delete Button Event Handler
499(1)
7.3.3.2 Build and Run the Project to Test the Data Deleting
500(2)
7.4 Perform Data Manipulations to Oracle Database Using Java Runtime Object
502(8)
7.4.1 Perform Data Insertion to Oracle Database Using Java Runtime Object
503(1)
7.4.1.1 Modify the FacultyFrame Window Form
503(1)
7.4.1.2 Develop the Codes for the Insert Button Event Handler
504(3)
7.4.2 Perform Data Updating to Oracle Database Using Java Runtime Object
507(2)
7.4.3 Perform Data Deleting to Oracle Database Using Java Runtime Object
509(1)
7.5 Perform Data Manipulations Using Updatable ResultSet
510(12)
7.5.1 Introduction to ResultSet Enhanced Functionalities and Categories
510(2)
7.5.2 Perform Data Manipulations Using Updatable ResultSet Object
512(1)
7.5.2.1 Insert a New Row Using the Updatable ResultSet
512(5)
7.5.2.2 Update a Row Using the Updatable ResultSet
517(3)
7.5.2.3 Delete a Row Using the Updatable ResultSet
520(2)
7.6 Perform Data Manipulations Using Callable Statements
522(28)
7.6.1 Perform Data Manipulations to SQL Server Database Using Callable Statements
523(1)
7.6.1.1 Insert Data to SQL Server Database Using Callable Statements
523(7)
7.6.1.2 Update Data to SQL Server Database Using Callable Statements
530(6)
7.6.1.3 Delete Data from SQL Server Database Using Callable Statements
536(4)
7.6.2 Perform Data Manipulations to Oracle Database Using Callable Statements
540(1)
7.6.2.1 Modify the CourseFrame Form Window
541(1)
7.6.2.2 Build Three Oracle Stored Procedures
542(5)
7.6.2.3 Build and Run the Project to Test the Data Manipulations
547(3)
7.7
Chapter Summary
550(5)
Homework
551(4)
PART II Building Three-Tier Client-Server Applications
555(354)
Chapter 8 Developing Java Web Applications to Access Databases
557(212)
8.1 A Historical Review about Java Web Application Development
557(40)
8.1.1 Using Servlet and HTML Web Pages for Java Web Applications
558(2)
8.1.2 Using JavaServer Pages (JSP) Technology for Java Web Applications
560(4)
8.1.3 Using Java Help Class Files for Java Web Applications
564(5)
8.1.4 Using Java Persistence APIs for Java Web Applications
569(3)
8.1.5 Using the JSP Implicit Object Session for Java Web Applications
572(1)
8.1.5.1 Modify the FacultyPage JSP File to Use the Session Object
572(2)
8.1.5.2 Build the Transaction JSP File FacultyQuery.jsp
574(1)
8.1.5.3 Build the Help Class FacultyBean
575(3)
8.1.6 Using Java Beans Technology for Java Web Applications
578(2)
8.1.6.1 Modify the Help Class FacultyBean to Make it a Java Bean Class
580(3)
8.1.6.2 Build a New Starting Web Page FacultyBeanPage
583(2)
8.1.7 Using JavaServer Faces Technology for Java Web Applications
585(1)
8.1.7.1 The Application Configuration Resource File faces-config.xml
586(1)
8.1.7.2 Sample JavaServer Face Page Files
587(3)
8.1.7.3 The Java Bean Class File
590(1)
8.1.7.4 The Web Deployment Descriptor File web.xml
591(1)
8.1.7.5 A Complete Running Procedure of JSF Web Applications
591(6)
8.2 Java EE Web Application Model
597(2)
8.2.1 Java EE Web Applications with and without EJB
598(1)
8.3 The Architecture and Components of Java Web Applications
599(12)
8.3.1 Java EE Containers
600(1)
8.3.2 Java EE 6 APIs
601(1)
8.3.2.1 EJBs API Technology
602(1)
8.3.2.2 Java Servlet API Technology
602(1)
8.3.2.3 JSP API Technology
603(1)
8.3.2.4 JavaServer Faces API Technology
604(2)
8.3.2.5 Java Persistence API
606(1)
8.3.2.6 Java Transaction API
606(1)
8.3.2.7 Java Message Service API
607(1)
8.3.3 Java Web Application Life Cycle
607(1)
8.3.4 Java Web Modules
607(2)
8.3.5 Java Web Frameworks
609(2)
8.4 Getting Started with Java Web Applications Using NetBeans IDE
611(14)
8.4.1 Create a Java Web Project
611(2)
8.4.2 Create the Entity Classes from the Database
613(1)
8.4.3 Create Five Web Pages Using Microsoft Office Publisher 2007
614(1)
8.4.3.1 Create the LogIn Page
615(2)
8.4.3.2 Create the Selection Page
617(2)
8.4.3.3 Create the Faculty Page
619(3)
8.4.3.4 Create the Course Page
622(3)
8.4.3.5 Create the Student Page
625(1)
8.5 Build Java Web Project to Access SQL Server Database
625(65)
8.5.1 Access and Query the LogIn Table Using JSP and Help Class Files
626(1)
8.5.1.1 Modify the LogIn.jsp Page and Create LogInQuery.jsp File
627(2)
8.5.1.2 Create the Java Help Class File LogInQuery.java
629(1)
8.5.1.3 Create a Dialog Box as the Message Box
630(2)
8.5.1.4 Develop the Codes for the Help Class File
632(3)
8.5.1.5 Add the JDBC Driver for the SQL Server Database into the Project
635(2)
8.5.2 Build the Selection Page
637(3)
8.5.3 Query the Faculty Table Using JSP and JSP Implicit Session Object
640(1)
8.5.3.1 Modify the Faculty.jsp Page
641(1)
8.5.3.2 Create the FacultyProcess.jsp Page
642(3)
8.5.3.3 Create the Help Class File FacultyQuery.java
645(5)
8.5.4 Insert New Records to the Faculty Table Using JSP and Java Beans
650(1)
8.5.4.1 Modify the Java Help Class FacultyQuery to Make it Java Bean Class
651(1)
8.5.4.2 Modify the FacultyProcess.jsp Page to Handle Faculty Data Collection and Insertion
652(4)
8.5.5 Update and Delete Data from the Faculty Table Using JSP and Java Beans Techniques
656(1)
8.5.5.1 Create a New Java Session Bean Class
656(3)
8.5.5.2 Modify the FacultyProcess Page to Handle Faculty Data Updating
659(4)
8.5.5.3 Add a Method to the Session Bean to Perform Faculty Data Deleting
663(1)
8.5.5.4 Modify the FacultyProcess Page to Handle Faculty Data Deleting
664(4)
8.5.6 Query Data from the Course Table Using JavaServer Faces and Java Beans
668(1)
8.5.6.1 Modify the Course Page to Make it JavaServer Face Page
668(4)
8.5.6.2 Build the JavaServer Face Managed Bean CourseBean
672(4)
8.5.6.3 Build the Session Bean for Entity Classes CourseFacade
676(4)
8.5.6.4 Set Up Calling Relationship between the JSF Bean and the Session Bean
680(1)
8.5.6.5 Build and Run the Project to Test the Course Information Query Functions
681(1)
8.5.7 Update Records from the Course Table Using JavaServer Faces and Java Beans
682(1)
8.5.7.1 Create Codes for the Update() Method in the JSF Managed Bean
683(1)
8.5.7.2 Create Codes for the UpdateCourse() Method in the Session Bean
684(3)
8.5.8 Delete Records from the Course Table Using JavaServer Faces and Java Beans
687(1)
8.5.8.1 Build Codes for the Delete() Method in the JSF Managed Bean
687(1)
8.5.8.2 Build Codes for the DeleteCourse() Method in the Session Bean
688(2)
8.6 Build Java Web Project to Access and Manipulate Oracle Database
690(74)
8.6.1 Create a Java Web Application Project
691(1)
8.6.2 Modify the Hibernate Configuration File
692(2)
8.6.3 Create Hibernate Utility Files and Mapping Files
694(1)
8.6.3.1 Create the HibernateUtil.java Helper File
694(1)
8.6.3.2 Generate Hibernate Mapping Files and Java Classes
695(2)
8.6.4 Query the LogIn Table Using JSF Pages and Java Beans
697(1)
8.6.4.1 Modify the LogIn.jsp Page to Make it JSF Page
698(2)
8.6.4.2 Create and Build the Java Managed Bean LogInBean Class
700(3)
8.6.5 Build the SelectionPage and the SelectionBean Class
703(4)
8.6.6 Build the ErrorPage to Display any Error Information
707(1)
8.6.7 Set Up the Navigation Rules for Existing Web Pages
708(3)
8.6.8 Query the Faculty Table Using JavaServer Faces and Java Beans
711(1)
8.6.8.1 Modify the Faculty.jsp to Make it Our JSF Page FacultyPage.jsp
711(4)
8.6.8.2 Build the Java Session Bean FacultySessionBean to Handle Data Actions
715(4)
8.6.8.3 Build the Java Managed Bean FacultyMBean to Manage Data Actions
719(4)
8.6.8.4 Run the Project to Test the Faculty Information Query
723(1)
8.6.8.5 Modify the faces-config.xml File to Run Project in a Web Pages Sequence
724(1)
8.6.8.6 Add Codes to the Project to Display a Selected Faculty Image
725(2)
8.6.8.7 Run the Entire Project to Test the Faculty Information Query
727(1)
8.6.9 Insert New Records to the Faculty Table Using JavaServer Faces and Java Beans
728(1)
8.6.9.1 Add the Codes to the Java Managed Bean to Manage Data Insertions
728(2)
8.6.9.2 Build the InsertFaculty() Method for the Session Bean to Perform Data Insertions
730(1)
8.6.9.3 Run the Project to Test the New Faculty Record Insertion
730(2)
8.6.10 Update and Delete Records from the Faculty Table Using JSF Page and Java Bean
732(1)
8.6.10.1 Add the Codes to the Java Managed Bean to Manage Data Updating
732(2)
8.6.10.2 Build the UpdateFaculty() Method in the Session Bean to Perform Data Updating
734(1)
8.6.10.3 Run the Project to Test the Faculty Record Updating Action
735(2)
8.6.10.4 Add the Codes to the Java Managed Bean to Manage Data Deleting
737(1)
8.6.10.5 Build the DeleteFaculty() Method in the Session Bean to Perform Data Deleting
738(1)
8.6.10.6 Run the Project to Test the Faculty Record Deleting Action
739(2)
8.6.10.7 Build the Codes for the Back Button Action Attribute in JSF Page
741(1)
8.6.11 Query Data from the Course Table Using JavaServer Faces and Java Beans
741(1)
8.6.11.1 Build the JavaServer Face Managed Bean CourseBean
742(4)
8.6.11.2 Build the Java Session Bean CourseSessionBean
746(4)
8.6.11.3 Set Up Calling Relationship between the Managed Bean and the Session Bean
750(1)
8.6.11.4 Run and Test the Single Page---CoursePage.jsp
750(1)
8.6.11.5 Set Up the Navigation Rules for the CoursePage and the SelectionPage
751(3)
8.6.11.6 Run and Test the Project in a Sequence Way
754(1)
8.6.12 Update and Delete Records for the Course Table Using JSF Pages and Java Beans
754(1)
8.6.12.1 Add the Codes to the Java Managed Bean to Manage Data Updating
754(1)
8.6.12.2 Build the UpdateCourse() Method in the Session Bean to Perform Data Updating
755(2)
8.6.12.3 Run the Project to Test the Course Record Updating Action
757(2)
8.6.12.4 Add the Codes to the Java Managed Bean to Manage Data Deleting
759(1)
8.6.12.5 Build the DeleteCourse() Method in the Session Bean to Perform Data Deleting
760(1)
8.6.12.6 Run the Project to Test the Course Record Deleting Action
761(1)
8.6.12.7 Build the Codes for the Back Button Action Attribute in JSF Page
762(2)
8.7
Chapter Summary
764(5)
Homework
765(4)
Chapter 9 Developing Java Web Services to Access Databases
769(140)
9.1 Introduction to Java Web Services
770(2)
9.1.1 REST-Based Web Services
770(1)
9.1.2 SOAP-Based Web Services
771(1)
9.2 The Structure and Components of SOAP-Based Web Services
772(2)
9.3 The Procedure of Building a Typical SOAP-Based Web Service Project
774(12)
9.3.1 Create a New Java Web Application Project WSTestApplication
775(1)
9.3.2 Create A New Java SOAP-Based Web Service Project WSTest
776(1)
9.3.3 Add Desired Operations to the Web Service
777(3)
9.3.4 Deploy and Test the Web Service on the Selected Container
780(2)
9.3.5 Create Web Service Clients to Consume the Web Service
782(4)
9.4 Getting Started with Java Web Services Using NetBeans IDE
786(1)
9.5 Build Java Web Service Projects to Access SQL Server Database
787(8)
9.5.1 Create a New Java Web Application Project WebServiceSQLApp
787(1)
9.5.2 Create a New Java SOAP-Based Web Service Project WebServiceSQL
788(1)
9.5.3 Add Desired Operations to the Web Service
789(1)
9.5.4 Add New Operations to Our Web Services to Perform Data Query
790(2)
9.5.5 Build the User-Defined Method DBConnection()
792(1)
9.5.6 Deploy the Web Service Project and Test the Data Query Function
793(2)
9.6 Build a Windows-Based Web Client Project to Consume the Web Service
795(6)
9.6.1 Copy the FacultyFrame and MsgDislog Components as GUIs
795(2)
9.6.2 Create a Web Service Reference for Our Windows-Based Client Project
797(2)
9.6.3 Develop the Codes to Call Our Web Service Project
799(2)
9.6.4 Build and Run Our Client Project to Query Faculty Data via Web Service
801(1)
9.7 Build a Web-Based Client Project to Consume the Web Service
801(7)
9.7.1 Create a Web-Based Client Project WebClientSQL
802(1)
9.7.2 Create a Java Managed Bean FacultyMBean and Add the JDialog Class MsgDialog
803(1)
9.7.3 Create a Web Service Reference for Our Web-Based Client Project
804(1)
9.7.4 Build the Codes to Call the Web Service to Perform Data Query
805(3)
9.7.5 Build and Run Our Client Project to Query Faculty Data via Web Service
808(1)
9.8 Build Java Web Service to Insert Data into the SQL Server Database
808(3)
9.8.1 Add a New Operation InsertFaculty() into Our Web Service Project
809(2)
9.8.2 Deploy the Web Service Project
811(1)
9.9 Build a Windows-Based Web Client Project to Consume the Web Service
811(4)
9.9.1 Refresh the Web Service Reference for Our Windows-Based Client Project
812(1)
9.9.2 Develop the Codes to Call Our Web Service Project
812(2)
9.9.3 Build and Run Our Client Project to Insert Faculty Data via Web Service
814(1)
9.10 Build a Web-Based Client Project to Consume the Web Service
815(4)
9.10.1 Refresh the Web Service Reference for Our Web-Based Client Project
816(1)
9.10.2 Develop the Codes to Call Our Web Service Project
816(2)
9.10.3 Build and Run Our Client Project to Insert Faculty Data via Web Service
818(1)
9.11 Build Java Web Service to Update and Delete Data from the SQL Server Database
819(8)
9.11.1 Add a New Operation UpdateFaculty() to Perform the Faculty Data Updating
820(2)
9.11.2 Add a New Operation DeleteFaculty() to Perform the Faculty Data Deleting
822(2)
9.11.3 Deploy and Test the Web Service Project
824(3)
9.12 Build a Windows-Based Web Client Project to Consume the Web Service
827(7)
9.12.1 Refresh the Web Service Reference for Our Windows-Based Client Project
827(1)
9.12.2 Develop the Codes to Call Our Web Service Project
827(1)
9.12.2.1 Build the Codes to Call the UpdateFaculty() Operation
827(3)
9.12.2.2 Build the Codes to Call the DeleteFaculty() Operation
830(1)
9.12.3 Build and Run Our Client Project to Update and Delete Faculty Record via Web Service
831(3)
9.13 Build a Web-Based Client Project to Consume the Web Service
834(6)
9.13.1 Refresh the Web Service Reference for Our Web-Based Client Project
834(1)
9.13.2 Develop the Codes to Call Our Web Service Operation UpdateFaculty()
835(2)
9.13.3 Develop the Codes to Call Our Web Service Operation DeleteFaculty()
837(1)
9.13.4 Build and Run Our Client Project to Update and Delete Faculty Record via Web Service
838(2)
9.14 Build Java Web Service Projects to Access Oracle Databases
840(33)
9.14.1 Create a New Java Web Application Project WebServiceOracleApp
841(1)
9.14.2 Create a New Java SOAP-Based Web Service Project WebServiceOracle
842(1)
9.14.3 Add a JDialog Class into the Web Services Project
843(1)
9.14.4 Add Java Persistence API and Entity Classes from Database
843(2)
9.14.5 Add Java Session Beans for Entity Classes
845(3)
9.14.6 The Organization of Web Service Operations and Session Bean Methods
848(1)
9.14.7 Add the Session Bean Classes CourseFacade into Our Web Service
849(1)
9.14.8 Create and Build the Session Bean Methods and Web Service Operations
849(1)
9.14.8.1 Create and Build Session Bean Method getCourseID()
850(2)
9.14.8.2 Create and Build Web Service Operation QueryCourseID()
852(2)
9.14.8.3 Build and Run the Web Service to Test the course_id Query Function
854(1)
9.14.8.4 Create and Build Session Bean Method getCourse()
855(2)
9.14.8.5 Create and Build Web Service Operation QueryCourse()
857(1)
9.14.8.6 Build and Run the Web Service to Test the Course Query Function
858(2)
9.14.8.7 Create and Build Session Bean Method newCourse()
860(2)
9.14.8.8 Create and Build Web Service Operation InsertCourse()
862(1)
9.14.8.9 Build and Deploy the Web Service Project
863(1)
9.14.8.10 Create and Build Session Bean Method setCourse()
864(3)
9.14.8.11 Create and Build Web Service Operation UpdateCourse()
867(1)
9.14.8.12 Build and Deploy the Web Service Project
868(1)
9.14.8.13 Create and Build Session Bean Method removeCourse()
868(2)
9.14.8.14 Create and Build Web Service Operation DeleteCourse()
870(1)
9.14.8.15 Build and Test the Web Service Project
871(2)
9.15 Build a Windows-Based Web Client Project to Consume the Web Service
873(17)
9.15.1 Create a New Windows-Based Web Client Project WinClientOracle
873(1)
9.15.2 Copy the CourseFrame and MsgDislog Components as GUIs
874(1)
9.15.3 Create a Web Service Reference for Our Windows-Based Client Project
875(1)
9.15.4 Develop the Codes to Call Our Web Service Project
876(1)
9.15.4.1 Build Codes for the Select Button Method to Query CourseIDs
877(2)
9.15.4.2 Build Codes for the CourseListValueChanged() Method to Get Course Details
879(3)
9.15.4.3 Build Codes for the Insert Button Method to Insert Courses
882(3)
9.15.4.4 Build Codes for the Update Button Method to Update Courses
885(3)
9.15.4.5 Build Codes for the Delete Button Method to Delete Courses
888(2)
9.16 Build a Web-Based Web Client Project to Consume the Web Service
890(14)
9.16.1 Create a Web-Based Client Project WebClientOracle
890(1)
9.16.2 Create a Java Managed Bean CourseBean and Add the JDialog Class MsgDialog
891(2)
9.16.3 Create a Web Service Reference for Our Web-Based Client Project
893(1)
9.16.4 Develop the Codes to Call Our Web Service Project
894(1)
9.16.4.1 Build Codes for the Select Button Method to Query CourseIDs
894(3)
9.16.4.2 Build Codes for the Detail Button Method to Get Course Details
897(2)
9.16.4.3 Build Codes for the Update Button Method to Update Courses
899(2)
9.16.4.4 Build Codes for the Delete Button Method to Delete Courses
901(3)
9.17
Chapter Summary
904(5)
Homework
905(4)
Index 909(10)
About the Author 919
Ying Bai, PhD, is a Professor in the Department of Computer Science and Engineering at Johnson C. Smith University. He has extensive experience in database programming, software programming, and robotic controls. Dr. Bai is a Senior Member of the IEEE and a member of the ACM. He has published eight books and more than thirty papers on database programming, interface programming, and fuzzy logic controls.