Practical Database Programming with Java 1st Edition Ying Bai download
Practical Database Programming with Java 1st Edition Ying Bai download
https://ebookultra.com/download/practical-database-programming-with-
java-1st-edition-ying-bai/
https://ebookultra.com/download/practical-database-programming-with-
visual-basic-net-second-edition-ying-baiauth/
https://ebookultra.com/download/expert-oracle-and-java-security-
programming-secure-oracle-database-applications-with-java-1st-edition-
david-coffin/
https://ebookultra.com/download/introduction-to-programming-with-
java-3rd-edition-john-dean/
https://ebookultra.com/download/beginning-programming-with-java-for-
dummies-4th-edition-barry-burd/
https://ebookultra.com/download/beginning-programming-with-java-for-
dummies-5th-edition-barry-burd/
https://ebookultra.com/download/cocoon-2-programming-web-publishing-
with-xml-and-java-1st-edition-bill-brogden/
https://ebookultra.com/download/programming-wireless-devices-with-the-
java-2-platform-2nd-edition-roger-riggs/
Ying Bai
Department of Computer Science and Engineering
Johnson C. Smith University
Charlotte, North Carolina
IEEE PRESS
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under
Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of
the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance
Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4470, or on the web at
www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions
Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201)
748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in
preparing this book, they make no representations or warranties with respect to the accuracy or
completeness of the contents of this book and specifically disclaim any implied warranties of merchantability
or fitness for a particular purpose. No warranty may be created or extended by sales representatives or
written sales materials. The advice and strategies contained herein may not be suitable for your situation. You
should consult with a professional where appropriate. Neither the publisher nor author shall be liable for any
loss of profit or any other commercial damages, including but not limited to special, incidental, consequential,
or other damages.
For general information on our other products and services or for technical support, please contact our
Customer Care Department within the United States at (800) 762-2974, outside the United States at (317)
572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not
be available in electronic formats. For more information about Wiley products, visit our web site at www.
wiley.com.
10 9 8 7 6 5 4 3 2 1
This book is dedicated to my wife, Yan Wang,
and to my daughter, Xue Bai.
Contents
Preface xxiii
Acknowledgments xxv
Chapter 1 Introduction 1
What This Book Covers 2
How This Book Is Organized and How to Use This Book 3
How to Use the Source Code and Sample Databases 5
Instructor and Customer Support 6
Homework Solutions 7
5.3.4 Build
a Java Web Application Project 214
5.3.5 Build
a Java Enterprise Edition Project 214
5.3.5.1 Overview of Java Enterprise Edition 6 215
5.3.5.2 Install and Configure Java EE 6 Software and Tools 222
5.3.5.3 Create a Java EE 6 Web Application Project 224
5.3.5.4 Creating the Entity Classes from the Database 227
5.3.5.5 Creating Enterprise Java Beans 229
5.3.5.6 Using JavaServer Faces (JSF) 2.0 232
5.3.5.7 Creating the Manufacturer Managed Bean 234
5.3.5.8 Creating the Manufacturer Listing Web Page 235
5.3.5.9 Building and Running the First Java EE 6 Web Page 238
5.3.5.10Deploying the Project Using the Administration Console 239
5.3.5.11Creating the Manufacturer Details Web Page 241
5.3.5.12Creating and Editing the faces-config.xml Configuration File 242
5.3.5.13Editing the General Web Application Configuration
File web.xml 247
5.3.5.14 Modifying the JSF Pages to Perform Page Switching 248
5.3.5.15 Building and Running the Entire Java EE 6 Project 249
5.3.6 Build a Maven Project 251
5.3.6.1 Introduction to Maven 251
5.3.6.2 Introduction to Hibernate Framework 253
5.3.6.3 Installing and Configuring the Apache Maven 255
5.3.6.4 Configuring Maven Inside the NetBeans IDE 258
5.3.6.5 Creating a Maven Database Application Project 259
5.3.6.6 Adding Hibernate Files and Dependencies 261
5.3.6.7 Generating Hibernate Mapping Files and Java Classes 265
5.3.6.8 Creating the Application GUI 268
5.3.6.9 Creating the Query in the HQL Query Editor 270
5.3.6.10 Adding the Query to the GUI Form 272
5.3.7 Build a PHP Project 276
5.3.7.1 Introduction to PHP 276
5.3.7.2 Downloading and Installing Apache HTTP Web Server 277
5.3.7.3 Configuring and Testing the Installed Apache HTTP
Web Server 279
5.3.7.4 Downloading and Installing the PHP Engine 280
5.3.7.5 Testing the Installed PHP Engine 281
5.3.7.6 Creating a PHP Project 283
5.3.7.7 Downloading and Configuring MySQL Database Server 285
5.3.7.8 Configuring the MySQL Server in NetBeans IDE 288
5.3.7.9 Creating Our Sample Database MySQLSample 290
5.3.7.10 Building the Functions for the PHP Project 293
5.3.7.11 Running and Testing the PHP Project 297
5.3.8 Build a NetBeans Module 299
5.3.8.1 Create a New NetBeans Module Project 300
5.3.8.2 Create the Customer Entity Class and Wrap It into a Module 301
5.3.8.3 Create Other Related Modules 303
5.3.8.4 Create the User Interface Module 306
xii Contents
6.2.8 Use Java JPA Wizards to Query the Course Table 372
6.2.8.1 Create a New CourseFrame Class and Add It into Our Project 372
6.2.8.2 Add Course Entity Manager and JPA Components into
the Project 373
6.2.8.3 Use Entity Classes to Perform Data Query from the
Course Table 374
6.2.9 Use Java JPA Wizards to Query Oracle Database 381
6.5 Create a Java Application Project to Access the Oracle Database 441
6.5.1 Create Graphic User Interfaces 442
6.5.2 Perform the Data Query for the LogIn Table 442
6.5.2.1 Add Oracle JDBC Driver to the Project 442
6.5.2.2 Load and Register Oracle JDBC Driver 443
6.5.2.3 The JDBC Uniform Resource Locators (URLs) 443
6.5.3 Develop the Codes for the SelectionFrame Form 445
6.5.4 Perform the Data Query for the Faculty Table 445
6.5.4.1 Create an Oracle Package FacultyInfo 446
6.5.4.2 Develop the Codes to Perform the CallableStatement Query 447
6.5.5 Perform the Data Query for the Course Table 449
6.5.5.1 Create an Oracle Package FacultyCourse 449
6.5.5.2 Develop the Codes to Perform the CallableStatement Query 451
6.5.6 Query Data from the Student Table Using the Java RowSet Object 453
6.5.6.1 Modify the Codes in the Constructor of the
StudentFrame Class 453
6.5.6.2 Modify the Codes in the Select Button Click Event Handler 453
6.6 Chapter Summary 455
Homework 457
Section II Insert, Update and Delete Data Using Java Runtime Objects Method 488
8.4.3 Create Five Web Pages Using Microsoft Office Publisher 2007 614
8.4.3.1 Create the LogIn Page 615
8.4.3.2 Create the Selection Page 617
8.4.3.3 Create the Faculty Page 619
8.4.3.4 Create the Course Page 622
8.4.3.5 Create the Student Page 625
8.5 Build Java Web Project to Access SQL Server Database 625
8.5.1 Access and Query the LogIn Table Using JSP and Help Class Files 626
8.5.1.1 Modify the LogIn.jsp Page and Create LogInQuery.jsp File 627
8.5.1.2 Create the Java Help Class File LogInQuery.java 629
8.5.1.3 Create a Dialog Box as the Message Box 630
8.5.1.4 Develop the Codes for the Help Class File 632
8.5.1.5 Add the JDBC Driver for the SQL Server Database into
the Project 635
8.5.2 Build the Selection Page 637
8.5.3 Query the Faculty Table Using JSP and JSP Implicit
Session Object 640
8.5.3.1 Modify the Faculty.jsp Page 641
8.5.3.2 Create the FacultyProcess.jsp Page 642
8.5.3.3 Create the Help Class File FacultyQuery.java 645
8.5.4 Insert New Records to the Faculty Table Using JSP and Java Beans 650
8.5.4.1 Modify the Java Help Class FacultyQuery to Make it Java
Bean Class 651
8.5.4.2 Modify the FacultyProcess.jsp Page to Handle Faculty Data
Collection and Insertion 652
8.5.5 Update and Delete Data from the Faculty Table Using JSP and Java
Beans Techniques 656
8.5.5.1 Create a New Java Session Bean Class 656
8.5.5.2 Modify the FacultyProcess Page to Handle Faculty
Data Updating 659
8.5.5.3 Add a Method to the Session Bean to Perform Faculty
Data Deleting 663
8.5.5.4 Modify the FacultyProcess Page to Handle Faculty
Data Deleting 664
8.5.6 Query Data from the Course Table Using JavaServer Faces and
Java Beans 668
8.5.6.1 Modify the Course Page to Make it JavaServer Face Page 668
8.5.6.2 Build the JavaServer Face Managed Bean CourseBean 672
8.5.6.3 Build the Session Bean for Entity Classes CourseFacade 676
8.5.6.4 Set Up Calling Relationship between the JSF Bean and
the Session Bean 680
8.5.6.5 Build and Run the Project to Test the Course Information
Query Functions 681
8.5.7 Update Records from the Course Table Using JavaServer Faces and Java
Beans 682
8.5.7.1 Create Codes for the Update() Method in the JSF
Managed Bean 683
xviii Contents
9.5 Build Java Web Service Projects to Access SQL Server Database 787
9.5.1 Create a New Java Web Application Project WebServiceSQLApp 787
9.5.2 Create a New Java SOAP-Based Web Service Project WebServiceSQL 788
9.5.3 Add Desired Operations to the Web Service 789
9.5.4 Add New Operations to Our Web Services to Perform Data Query 790
9.5.5 Build the User-Defined Method DBConnection() 792
9.5.6 Deploy the Web Service Project and Test the Data Query Function 793
9.6 Build a Windows-Based Web Client Project to Consume the Web Service 795
9.6.1 Copy the FacultyFrame and MsgDislog Components as GUIs 795
9.6.2 Create a Web Service Reference for Our Windows-Based Client
Project 797
9.6.3 Develop the Codes to Call Our Web Service Project 799
9.6.4 Build and Run Our Client Project to Query Faculty Data via
Web Service 801
9.7 Build a Web-Based Client Project to Consume the Web Service 801
9.7.1 Create a Web-Based Client Project WebClientSQL 802
9.7.2 Create a Java Managed Bean FacultyMBean and Add the JDialog
Class MsgDialog 803
9.7.3 Create a Web Service Reference for Our Web-Based Client Project 804
9.7.4 Build the Codes to Call the Web Service to Perform Data Query 805
9.7.5 Build and Run Our Client Project to Query Faculty Data via
Web Service 808
9.8 Build Java Web Service to Insert Data into the SQL Server Database 808
9.8.1 Add a New Operation InsertFaculty() into Our Web Service Project 809
9.8.2 Deploy the Web Service Project 811
9.9 Build a Windows-Based Web Client Project to Consume the Web Service 811
9.9.1 Refresh the Web Service Reference for Our Windows-Based
Client Project 812
9.9.2 Develop the Codes to Call Our Web Service Project 812
9.9.3 Build and Run Our Client Project to Insert Faculty Data via
Web Service 814
9.10 Build a Web-Based Client Project to Consume the Web Service 815
9.10.1 Refresh the Web Service Reference for Our Web-Based
Client Project 816
9.10.2 Develop the Codes to Call Our Web Service Project 816
9.10.3 Build and Run Our Client Project to Insert Faculty Data via
Web Service 818
9.11 Build Java Web Service to Update and Delete Data from the SQL
Server Database 819
9.11.1 Add a New Operation UpdateFaculty() to Perform the Faculty
Data Updating 820
9.11.2 Add a New Operation DeleteFaculty() to Perform the Faculty
Data Deleting 822
9.11.3 Deploy and Test the Web Service Project 824
9.12 Build a Windows-Based Web Client Project to Consume the Web Service 827
9.12.1 Refresh the Web Service Reference for Our Windows-Based
Client Project 827
Contents xxi
9.12.2 Develop the Codes to Call Our Web Service Project 827
9.12.2.1 Build the Codes to Call the UpdateFaculty() Operation 827
9.12.2.2 Build the Codes to Call the DeleteFaculty() Operation 830
9.12.3 Build and Run Our Client Project to Update and Delete Faculty Record via
Web Service 831
9.13 Build a Web-Based Client Project to Consume the Web Service 834
9.13.1 Refresh the Web Service Reference for Our Web-Based Client Project 834
9.13.2 Develop the Codes to Call Our Web Service Operation
UpdateFaculty() 835
9.13.3 Develop the Codes to Call Our Web Service Operation
DeleteFaculty() 837
9.13.4 Build and Run Our Client Project to Update and Delete Faculty Record via
Web Service 838
9.14 Build Java Web Service Projects to Access Oracle Databases 840
9.14.1 Create a New Java Web Application Project WebServiceOracleApp 841
9.14.2 Create a New Java SOAP-Based Web Service Project
WebServiceOracle 842
9.14.3 Add a JDialog Class into the Web Services Project 843
9.14.4 Add Java Persistence API and Entity Classes from Database 843
9.14.5 Add Java Session Beans for Entity Classes 845
9.14.6 The Organization of Web Service Operations and Session Bean
Methods 848
9.14.7 Add the Session Bean Classes CourseFacade into Our Web Service 849
9.14.8 Create and Build the Session Bean Methods and Web Service
Operations 849
9.14.8.1 Create and Build Session Bean Method getCourseID() 850
9.14.8.2 Create and Build Web Service Operation QueryCourseID() 852
9.14.8.3 Build and Run the Web Service to Test the course_id Query
Function 854
9.14.8.4 Create and Build Session Bean Method getCourse() 855
9.14.8.5 Create and Build Web Service Operation QueryCourse() 857
9.14.8.6 Build and Run the Web Service to Test the Course Query
Function 858
9.14.8.7 Create and Build Session Bean Method newCourse() 860
9.14.8.8 Create and Build Web Service Operation InsertCourse() 862
9.14.8.9 Build and Deploy the Web Service Project 863
9.14.8.10 Create and Build Session Bean Method setCourse() 864
9.14.8.11 Create and Build Web Service Operation UpdateCourse() 867
9.14.8.12 Build and Deploy the Web Service Project 868
9.14.8.13 Create and Build Session Bean Method removeCourse() 868
9.14.8.14 Create and Build Web Service Operation DeleteCourse() 870
9.14.8.15 Build and Test the Web Service Project 871
9.15 Build a Windows-Based Web Client Project to Consume the Web Service 873
9.15.1 Create a New Windows-Based Web Client Project WinClientOracle 873
9.15.2 Copy the CourseFrame and MsgDislog Components as GUIs 874
9.15.3 Create a Web Service Reference for Our Windows-Based Client
Project 875
Random documents with unrelated
content Scribd suggests to you:
"Kirkko, josta puhutte", jatkoi Olavi, kääntyneenä arkkipiispaan ja
panematta mitään huomiota muiden katseihin ja sanoihin — "kirkko,
josta puhutte, on ihmiskäsien rakentama ylhäältä jalkoihinsa saakka,
se on irvikuva siitä kristinopista, jota meidän herramme ja apostolit
opettivat ja jota he vielä opettavat sanojensa kautta pyhässä
raamatussa. Kas, sen kirkon palvelija tahdon minä olla, sen kirkon
alttarilta ojennan käsivarteni teille, arkkipiispa Johan, ja teille kaikille
ja kysyn teiltä arkkipiispan sanoilla: annatteko kauvemmin sen
odottaa turhaan saadakseen syleillä kadotettua poikaansa?"
"Olavi! Olavi!"
4
KRISTINA GYLLENSTJERNA.
Samassa aukeni ovi ja junkkari Moritz astui sisään. Hän oli aivan
nuori mies, mutta niin hyvin hänen pukunsa kuin hänen päivettyneet
kasvonsa ja vapaat, pontevat liikkeensä ilmaisivat soturia, joka oli jo
kokenut monta ottelua elämästä ja kuolemasta. Hänen katseensa
hipaisi tutkivasti sekä kreiviä että molempia naisia, ja se pysähtyi
rouva Kristinaan.
"Siitä ette tiedä mitään, jalo rouva! Alussa vuotta olin sattumalta
Kööpenhaminassa ja näin teidät muiden ruotsalaisten naishenkilöjen
keralla, jotka herrani, kuningas Kristian … ai, miekkani kautta, hänen
nimeään ei minun pitänyt täällä mainita, mutta saman tekevä, —
silloin näin teidät eikä paljoa puuttunut etten ollut valmis teidän
tähtenne paljastamaan miekkaani omaa herraani vastaan."
"Pitäisi niin, sen asian laita on niin, nähkääs kreivi hyvä, että
Visborgin kylläkin pitäisi tällä haavaa olla kuningas Kustaan käsissä,
mutta kaikki ei täällä maailmassa ole kuten sen pitäisi olla."
"Ja se on?"
"Teidän on vannottava pyhä vala, ettette kellekään ilmaise, mitä
tulen teille ilmottamaan."
"Että saaren ja linnan saisi pitää se, jolla saari ja linna olivat
käsissään sinä päivänä, jona päätös tehtiin!"
"Ja se oli…?"
"Niin, niin, sanon minä", jatkoi junkkari. "Kaikki käy kuten tanssi,
rouva Kristina, Nils Steninpojan äiti on ojentanut kätensä herra
Severin Norbylle…"
"Kuninkaan luo…"
Rouva Kristina oli vielä siellä. Hän istui nojaten päällänsä ristityihin
käsiinsä, kun junkkari Moritz astui sisään, ja tällä hetkellä lepäsi niin
ylevän kaunis värisävy hänen jaloilla, mutta surullisilla kasvoillaan,
että itse karkea merirosvokin pysähtyi ja vaipui häntä katselemaan.
Sana, jonka hän oli lausumaisillaan, kuoli hänen huulilleen, ja näytti
siltä kuin hän hetkiseksi olisi unhottanut koko maailman.
"Mutta jos", jatkoi Moritz, "jos tapahtuisi, mitä nyt ei kukaan voi
aavistaa, että herrani pelastaisi Ruotsin valtakunnan…"
"Ei, ei, rouva Kristina, en uneksi … mutta jos pahat ja kovat ajat
jälleen tulisivat, jollei kuningas Kustaa voisi pitää yllä sen kruunun
valtaa, minkä hän on saanut, mutta jos Ruotsin valtakunta kuitenkin
seisoisi vapaana ja voimakkaana ja mahtavana, ja jos tämä uusi
pelastaja olisi Severin Norby, mitä silloin tekisitte?"
Aurinko oli nyt laskenut eikä mitään valoa ollut sytytetty saliin,
jossa sentähden hämärä kävi yhä pimeämmäksi. Niin Moritz kuin
rouva Kristinakin olivat siksi kiintyneet aineeseen, jota keskenään
pohtivat, etteivät ajatelleet tätä seikkaa, ja todennäkösesti oli
tapahtunut jotakin aivan satunnaista, joka esti palvelijat tavan
mukaan sytyttämästä valoa.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com