TAILIEUCHUNG - o'reilly database programming with JDBC and Java 2nd edition phần 7

Phần lớn là một vấn đề cài đặt một nhà máy sản xuất ổ cắm tùy chỉnh. Tôi một thời gian ngắn sẽ phác thảo các bước cần thiết để cài đặt một nhà máy sản xuất ổ cắm tùy chỉnh cho RMI. Một cuộc thảo luận chi tiết hơn về những vấn đề này có thể được tìm thấy trong các chương trình Java mạng Elliotte Rusty Harold (O'Reilly & Associates). | JDBC and Java 2nd edition public Connection getConnection throws SQLException if connection null Context ctx new InitialContext DataSource ds DataSource jdbc ora connection borg pw false return connection In this code I use the JDBC Optional Package method for connecting to a database. You may not have the JDBC Optional Package available to you in which case you may want to use the old-fashioned DriverManager approach to making a Connection. Either way you definitely want a pooled connection. Without access to the JDBC Optional Package you have to roll your own connection pooling. The heart of JDBC persistence rests in the persistence delegate. As you saw before in the PersistenceSupport interface an implementation is responsible for the SQL that inserts updates or deletes the object in question from the database. Each implementation is dependent on the particular entity it is persisting. Example provides the store method in the AccountSupport class to save an Account entity to the database. Example . The store Method for an Account Persistence Delegate static private String UPDATE UPDATE Account SET balance lastUpdateID lastUpdateTime WHERE objectID AND lastUpdateID AND lastUpdateTime public void store Transaction trans Memento mem throws StoreException long oid long lut String luid Connection conn null try PreparedStatement stmt Double d conn JDBCTransaction trans .getConnection stmt UPDATE d Double if d null 1 else 1 2 .getUserID 3 4 oid 5 luid page 149 JDBC and Java 2nd edition 6 lut if 1 throw new StoreException No row modified. catch SQLException e throw new CreateException e You may .

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.