Đang chuẩn bị liên kết để tải về tài liệu:
o'reilly database programming with JDBC and Java 2nd edition phần 3
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Cầu nối JDBC-ODBC là một công cụ tuyệt vời cho các nhà phát triển, những người quan tâm trong việc học JDBC nhưng có thể không muốn đầu tư vào bất cứ điều gì vượt ra ngoài cơ sở dữ liệu Microsoft Access mà đi kèm với Microsoft Office. | JDBC and Java 2nd edition order you placed them in the prepared statement. In the previous example I bound parameter 1 as a float to the account balance that I retrieved from the account object. The first was thus associated with parameter 1. 4.1.2 Stored Procedures While prepared statements let you access similar database queries through a single Preparedstatement object stored procedures attempt to take the black box concept for database access one step further. A stored procedure is built inside the database before you run your application. You access that stored procedure by name at runtime. In other words a stored procedure is almost like a method you call in the database. Stored procedures have the following advantages Because the procedure is precompiled in the database for most database engines it executes much faster than dynamic SQL which needs to be re-interpreted each time it is issued. Even if your database does not compile the procedure before it runs it will be precompiled for subsequent runs just like prepared statements. Syntax errors in the stored procedure can be caught at compile time rather than at runtime. Java developers need to know only the name of the procedure and its inputs and outputs. The way in which the procedure is implemented the tables it accesses the structure of those tables etc. is completely unimportant. A stored procedure is written with variables as argument place holders which are passed when the procedure is called through column binding. Column binding is a fancy way of specifying the parameters to a stored procedure. You will see exactly how this is done in the following examples. A Sybase stored procedure might look like this DROP PROCEDURE sp_select_min_bal GO CREATE PROCEDURE sp_select_min_bal @balance AS SELECT account id FROM account WHERE balance @balance GO The name of this stored procedure is sp_select_min_bal. It accepts a single argument identified by the @ sign. That single argument is the minimum balance. The