Developers: Learn a New Programming Language or App Development with Deitel LiveLessons Videos!
s
menu
menu
Login  |  Register  |  Media Kit  |  Press  |  Contact Us  |   Twitter Become a Deitel Fan on Facebook  
Custom Search



Minimize
Java How to Program 8/e Cover


ISBN: 0136053068
© 2010, pp. 1560

Order now at
Amazon.com
Informit.comtracking

Download Code
Examples and
Other Premium
Content for
Registered Users

Login or Register to download this book's code examples and other premium content.

Java How to Program, 8/e, Errata

REPLACEMENT FOR EXERCISE 31.3:

(Phone Book Web Service) Create a web service that stores phone book entries in the database PhoneBookDB and a web client application that consumes this service. Use the steps in Section 30.2.1 to create the PhoneBook database. The database contains one table—PhoneBook—with three columns—LastName, FirstName and PhoneNumber—each of type VARCHAR. The LastName and FirstName columns store up to 30 characters. The PhoneNumber column should support phone numbers of the form (800) 555-1212 that contain 14 characters.

Give the client user the capability to enter a new contact (web method addEntry) and to find contacts by last name (web method getEntries). Pass only Strings as arguments to the web service. The getEntries web method should return an array of Strings that contains the matching phone book entries. Each String in the array should consist of the last name, first name and phone number for one phone book entry. These values should be separated by commas.
The SELECT query that will find a PhoneBook entry by last name should be:

     SELECT LastName, FirstName, PhoneNumber
     FROM PhoneBook
     WHERE (LastName = LastName)

The INSERT statement that inserts a new entry into the PhoneBook database should be:

     INSERT INTO PhoneBook (LastName, FirstName, PhoneNumber)
     VALUES (LastName, FirstName, PhoneNumber)

[Note: Here is the SQL code to create the database]

     DROP TABLE PhoneBook;
     CREATE TABLE PhoneBook
     (
         FirstName VARCHAR (50) NOT NULL,
         LastName VARCHAR (50) NOT NULL,
         PhoneNumber VARCHAR (50) NOT NULL
     );
     INSERT INTO PhoneBook (FirstName,LastName,PhoneNumber)
         VALUES ('Bob', 'Green', '5555551111'),
                ('Sue', 'Black', '5555552222'),
                ('Liz', 'White', '5555553333'),
                ('Paul', 'Blue', '5555554444')

REPLACEMENT FOR EXERCISE 31.4:

(Phone Book Web Service Modification) Modify Exercise 31.3 so that it uses a class named PhoneBookEntry to represent a row in the database. The client application should provide objects of type PhoneBookEntry to the web service when adding contacts and should receive objects of type PhoneBookEntry when searching for contacts.

 

c

 

Discounts on SafariBooksOnline.com subscriptions

foot
Update :: November 19, 2017