Java 6 Platform Revealed phần 7

Tham khảo tài liệu 'java 6 platform revealed phần 7', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 110 CHAPTER 5 JDBC SQL ROWID Access Yet another interesting feature of JDBC is support for accessing the SQL built-in type ROWID for uniquely identifying the table row. One key thing to mention here it is only available if the underlying database supports giving it to you. To find this out you must ask DatabaseMetaData. Its getRowIdLifetime method returns a RowIdLifetime which has an enumeration of possible values ROWID_UNSUPPORTED ROWID_VALID_FOREVER ROWID_VALID_SESSION ROWID_VALID_TRANSACTION ROWID_VALID_OTHER Most of the values are fairly self-explanatory. ROWID_UNSUPPORTED means the data source doesn t support the feature. ROWID_VALID_FOREVER is like a diamond forever. ROWID_VALID_SESSION means for at least the session while ROWID_VALID_TRANSACTION means for the transaction. ROWID_VALID_OTHER means you can get a row ID from the system but have no clue how long it will last. Effectively you should treat this as ROWID_UNSUPPORTED as it can go away at any time. If the data sources returns a RowId you can get its value as either bytes via getBytes or as a String with toString . Which of the two you work with depends on your needs. Of course sometimes just RowId is sufficient. Here s a simple look at its usage ResultSet rs select name rank ROWID from people while String name getString 1 String rank getString 2 RowId rowid getRowId 3 . SQL 2003 XML Data Type Support Another big feature added to SQL 2003 is support for XML as a native data type in the database. From your Java programs you no longer have to use CLOBs to access the XML data elements. You get a JDBC mapping direct to the SQL XML type with Mustang. CHAPTER 5 JDBC 111 When querying a database with an XML column the type returned from the result set is of type SQLXML. While Chapter 6 looks more at the updated XML support in Mustang we ll look at the database side more here not actually reading writing the contents just fetching. The SQLXML interface is rather small

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.