WebSphere Studio Application Developer Version 5 Programming Guide part 21

WebSphere Studio Application Developer part 21 provides integrated development tools for all e-business development roles, including Web developers, Java developers, business analysts, architects, and enterprise programmers. The customizable, targeted, role-based approach of WebSphere Studio Application Developer will be characteristic of all new products built on the WebSphere Studio Workbench. It is well integrated with WebSphere Application Server and provides built-in server test environments that can be used for testing and profiling Web applications | To test the statement select it in the Statements folder and Execute context or select SQL - Execute in the menu bar. Enter C as the value for the type and o as the value for the lastname variables in the Host Variable Values window and click Finish to execute the query. The matching rows from the database are shown in the DB Output view Figure 6-38 . Figure 6-38 SQL Query Builder testing the SQL statement Later on we will look at how you can use Application Developer to generate Web pages and Java classes to quickly and easily build an application based on an SQL statement that uses host variables. We will use this SQL statement in Accessing databases from a Web application on page 248. Accessing databases from a Java application We have already seen an example of how to access a relational database using JDBC from a Java application. In Chapter 5 Developing Java applications on page 93 we created a simple application CustomerListing Figure 5-10 on page 102 that accesses a DB2 table to return a list of customers. We now take a closer look at database access. Access using the DriverManager We use the driver manager class to manage the connection to the database. First we have to establish a connection to the database as shown in Figure 6-39. The first thing that has to be done is to load the JDBC driver. The call does this. The driver name is dependent on which database you are connecting to. Note You do not have to create an instance of the driver or register it. This is done automatically for you by the DriverManager class. 174 WebSphere Studio Application Developer Version 5 Programming Guide protected static Connection connect Connection con null try con jdbc db2 EJBBANK catch Exception e . return con Figure 6-39 Establish a connection to the database After loading the driver you have to establish a connection. The class that handles this is called DriverManager. The URL .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
110    374    3    01-06-2024
Đã 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.