Download presentation
Presentation is loading. Please wait.
Published byBertram Walker Modified over 9 years ago
1
JDBC By 朱志興
2
Four driver types of JDBC (1) JDBC-ODBC bridge plus ODBC driver: Java Database Client JDBC- ODBC bridge ODBC driver Database Server A B C
3
Four driver types of JDBC (2) Native-API partly Java driver: Java Database Client JDBC Driver Java &binary Vender- specific protocol Database Server
4
Four driver types of JDBC (3) JDBC-Net pure Java driver: Database Client Database Access Server Database Server A B C JDBC Driver pure Java
5
Four driver types of JDBC (4) Native-protocol pur Java driver: Java Database Client JDBC Driver pure Java Vender- specific protocol Database Server
6
Example: AccessApp(1) 使用到的 Class: –DriverManager Class: getConnection(String url), or getConnection(String url, String userID, String password), or getConnection(String url, Properties arguments) –url ---- jdbc:subprotocol:subname
7
Example: AccessApp(2) –Connection Interface: close() getMetaData() - 傳回 DatabaseMataData interface 可 以得到資料庫的結構和能力 createStatement() - Creates an SQL Statement object –Statement Interface: executeQuery() - SELECT, return ResultSet object executeUpdate() - INSERT, UPDATE, DELETE execute() - return boolean
8
Example: AccessApp(3) getResultSet(), getMoreResults() - retrieve the ResultSet object ResultSet Interface: – 一次只處理一個 row, 使用 next() 來將 cursor 移 至下一個 row.
9
Transaction Processing(1) Solves the database update problem. setAutoCommit(), commit(), rollback(). Transaction Isolation: –Eliminates problems associated with multiple database. –Transaction isolation levels - Hegher levels executes first. (reduces database performance ??)
10
Transaction Processing(2) –getTransactionIsolation(), getTransactionIsolation() (Connection Interface), supportsTransactionIsolation() (DatabaseMetaData Interface). –EX: CommitApp
11
Transaction Isolation Eliminates problems associated with multiple database updates. Transaction isolation levels - Hegher levels executes first. (reduces database performance ??)
12
Database Security Relies on the database server to provide security protection. JDBC driver to database server communication security protection.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.