TAILIEUCHUNG - Java Server Pages: A Code-Intensive Premium Reference- P14

Java Server Pages: A Code-Intensive Premium Reference- P14:Before you begin reading Pure JSP Java Server Pages, you might want to take a look at its basic structure. This should help you outline your reading plan if you choose not to read the text from cover to cover. This introduction gives you an overview of what each chapter covers. | A JDBC Connection Pool To make use of our pooled connections we need a ConnectionPool object to manage them. The requirements for our ConnectionPool object are 1. 2. 3. 4. It must hold n number of open connections. It must be able to determine when a connection is in use. If n 1 conn ections are requested it must create a new connection and add it to the pool. When we close the pool all connections must be released. Now that we know what we want let s look at what we came up with. The source for our ConnectionPool object is in Listing . Listing package import . import . public class ConnectionPool JDBC Driver Name private String driver null URL of database private String url null Initial number of connections. private int size 0 Username private String username new String Password private String password new String Vector of JDBC Connections private Vector pool null - 131 - public ConnectionPool Il Set the value of the JDBC Driver public void setDriver String value if value null driver value Il Get the value of the JDBC Driver public String getDriver return driver II Set the URL Pointing to the Datasource public void setURL String value if value null url value II Get the URL Pointing to the Datasource public String getURL - 132 - return url Set the initial number of connections public void setSize int value if value 1 size value Get the initial number of connections public int getSize return size Set the username public void setUsername String value if value null username value Get the username public String getUserName - 133

TỪ KHÓA LIÊN QUAN
Đã 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.