12.07.2015 Views

DB2 data manipulation

DB2 data manipulation

DB2 data manipulation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

developerWorks®ibm.com/developerWorksRELEASE SAVEPOINT SAVEPOINT1If you do not explicitly release a savepoint with a RELEASE SAVEPOINT SQLstatement, it is released at the end of the transaction.To roll back to a savepoint, issue a ROLLBACK TO SAVEPOINT SQL statement. Forexample:ROLLBACK TO SAVEPOINT SAVEPOINT1Section 8. Work with large objectsWhat is a large object?Large <strong>data</strong> objects, such as images and audio, frequently need to be stored in a<strong>data</strong>base. <strong>DB2</strong> provides specialized <strong>data</strong> types for storing large <strong>data</strong> objects. These<strong>data</strong> types are known as large objects (LOBs). In this section, you'll be exploring theworld of LOBs. As a developer, you should be able to store and retrieve LOBs inyour applications.<strong>DB2</strong> provides three different types of LOB <strong>data</strong> types. All of these <strong>data</strong> types canhouse up to 2 gigabytes of <strong>data</strong>:• CLOB -- Contains up to 2 gigabytes of character <strong>data</strong>• BLOB -- Contains up to 2 gigabytes of binary <strong>data</strong>. This binary <strong>data</strong>could, in essence, be anything (such as an image or an audio file).• Double-Byte Character Large Object (DBCLOB) -- Contains up to 2gigabytes of double-byte character <strong>data</strong>. Note that this <strong>data</strong> type shouldonly be used if the <strong>data</strong>base you created was configured for double-byte<strong>data</strong>.• XML -- Contains up to 2 gigabytes of XML <strong>data</strong>. XML is not covered inthis tutorial, as they are covered later in the tutorial series.LOB values are not stored in a <strong>data</strong>base table. What is actually stored is adescriptor. This descriptor points to the actual location of the LOB. The actual LOBvalues are stored in tablespaces. Tablespaces are units of physical storage. What isactually housed in a LOB column is not the actual LOB <strong>data</strong>, but in fact a pointer tothe LOB <strong>data</strong>. This pointer is known as a "locator." These so called locators areused to represent your LOB values. When you retrieve <strong>data</strong> in a ResultSet, you'll beretrieving locators and not the actual LOB values that they represent. You have to<strong>DB2</strong> <strong>data</strong> <strong>manipulation</strong>Page 20 of 25© Copyright IBM Corporation 1994, 2007. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!