Database Toolbox Previous page   Next Page

Retrieving BINARY and OTHER Java Data

The Database Toolbox supports the data types listed in Data Types with no data manipulation required. You can also import BINARY and OTHER Java SQL objects, such as bitmap images. The process for importing BINARY and OTHER Java objects differs from the standard VQB import process in these ways:

Retrieving Images in Data

This example uses the SampleDB data source and a sample file for parsing image data, $matlabroot/toolbox/database/vqb/parsebinary.m. For more information about the data source, see Setting Up a Data Source.

  1. In the VQB dialog box, select
    1. Select for Data Operation.
    2. SampleDB from Data source.
    3. Employees from Tables.
    4. EmployeeID and Photo from Fields.
  1. The Photo field contains bitmap images.

  1. Select Query -> Preferences and specify the Data return format as cellarray or structure.
  2. Assign A as the MATLAB workspace variable and click Execute.
  3. Type A to view the contents.
  1. MATLAB displays

    The data in column 2 of the imported data, [21626x1 B[]], indicates that the data type is BINARY.

  1. Assign the first element in the image data to the variable photo. Type
  2. Run the sample program parsebinary, which will display photo as a bitmap image.
  1. The bitmap image displays in a figure window.

    The parsebinary M-file writes the retrieved data to a file, strips ODBC header information, and displays a bitmap image. For more details, type help parsebinary or view the parsebinary M-file in the MATLAB Editor by typing open parsebinary.

This is just one example of retrieving a BINARY object. Your application might require different manipulations to process the data in MATLAB.


Previous page  Other Features in Advanced Query Options Exporting Data Using the VQB Next page

© 1994-2005 The MathWorks, Inc.