1 / 12

CS276 Advanced Oracle Using Java

CS276 Advanced Oracle Using Java. Large Objects Chapter 8. The Example Files.

lovie
Download Presentation

CS276 Advanced Oracle Using Java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS276 Advanced Oracle Using Java Large Objects Chapter 8

  2. The Example Files Some of the examples read files and store their contents in the database, but the contents of a LOB doesn’t have to come from a file – the content can come from any valid source that your Java program can read as astring of characters or bytes. • textContent.txt • binaryContent.doc

  3. Large Objects(LOBs) JDBC supports three large object types: • CLOB The Character LOB type • BLOB The Binary LOB type • BFILE The Binary FILE type, which is used to store pointers to files located in the file system. You can read the contents of the actual file via a BFILE pointer in a Java program. These external files can be on a hard disk, a CD, a DVD and etc.

  4. Large Objects(LOBs) LOBs consist of two parts: • The LOB locator • A pointer that specifies the location of the LOB content • The LOB content • The actual character or byte data stored in the LOB

  5. Large Objects(LOBs) The Example Tables: • clob_content • clob_column is used to store the character data contained in the textContent.txt • blob_content • blob_column is used to store the binary data contained in the binaryContent.doc • bfile_content • is used to store pointer to the two exetrnal files

  6. The Put, Get, and Stream Methods When working with LOBs using JDBC, you need to create a LOB object. It is through this LOB object that you access a LOB column. The Oracle.sql package contains: oracle.sql.CLOB oracle.sql.BLOB oracle.sql.BFILE

  7. Using the Put Methods to Write to CLOB and BLOB Columns LobExample1.java This program contains the following methods: writeCLOB()writeBLOB() writeBFILE()

  8. Using the Streams to Write to CLOB and BLOB Columns • LobExample3.java

  9. Using the GetMethods to Read from CLOB and BLOB Columns LobExample2.java it shows how to read from CLOB and BLOB columns and how to read external files pointed to by BFILE columns This program contains the following methods: readCLOB()readBLOB() retrieveBFILE()

  10. LONG and LONG RAW Columns We use two new tables: • long_content • long_raw_content

  11. Writing to LONG and LONG RAW Columns You can use eight steps to use a stream to write to… LongExample1.java

  12. Reading from LONG and LONG RAW Columns You can use eight steps to use a stream to write to… LongExample2.java

More Related