TAILIEUCHUNG - Xml programming bible phần 10

Lệnh SQL, AuthorName chọn từ các tác giả, lựa chọn tất cả các giá trị trong cột AuthorName của bảng tác giả. Lớp buildArray được sử dụng bởi các lớp GetAuthorList và GetSingleAuthorList để xây dựng một mảng từ một tập hợp kết quả DB2JDBC. | Chapter 36 Accessing Relational Data via Web Services 851 The SQL command select AuthorName from Authors selects all of the values in the AuthorName column of the Authors table. The buildArray class that is used by the GetAuthorList and GetSingleAuthorList classes to build an array from an DB2JDBC result set. An ArrayList is created which is an implementation of the List interface. The most important feature of ArrayLists for the purposes of this code is that they are automatically resizable via the add method. Note We have explicitly specified because the package also has a List interface. The JDBC specification contains a .toArray method for result sets which would be great for this purpose. However not all JDBC drivers implement a complete set of methods for JDBC classes. The code in the buildArray class can be used when the toArray method is not supported as is the case with the DB2JDBC driver or when you want all JDBC result set array output to be the same regardless of driver-specific formatting. A DB2result set is passed from the calling object and an ArrayList is defined called arrayResults. The code loops through the result set and retrieves the current result set row value as a string. DB2result set values returned by the DB2JDBC driver sometimes contain leading and trailing blanks so the trim method is sued to trim spaces off the string as it is created. The string is added to the array Results object using the method. Next a string array called sarray is created and the value of the ArrayList is passed to the string array using the method. The buildArray class creates a string array from the JDBC result set which is passed to the J2EE application that called the Web service via a SOAP envelope Listing 36-1 . Listing 36-1 The XMLPBWSMTServletGetAuthorList Web Service Code import . import . import . public class XMLPBWSMTServletGetAuthorList public String GetAuthorList String

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.