Database Toolbox |
Retrieving BINARY or OTHER Java SQL Data Types
You can retrieve BIN
ARY
or O
THER
Java SQL data types, however, the data might require additional processing once retrieved. For example, you can retrieve data from a MAT-file or an image file. MATLAB cannot process these data types directly. You need knowledge of the content and might need to massage the data in order to work with it in MATLAB, such as stripping off leading entries added by your driver during data retrieval.
In this example, you import data that includes bitmap images. You use a sample M-file included with the Database Toolbox in the vqb
directory:
Perform these steps to retrieve bitmap image data for the example:
SampleDB
. Type
cellarray
or structure
. For this example, set it to cellarray
by typing
EmployeeID
and Photo
columns of data from the Employees
table. Type
ans = [1] [21626x1 B[]] [2] [21626x1 B[]] [3] [21722x1 B[]] [4] [21626x1 B[]] [5] [21626x1 B[]] [6] [21626x1 B[]] [7] [21626x1 B[]] [8] [21626x1 B[]] [9] [21626x1 B[]]
The data in column 2
of the imported data,[21626x1 B[]],
indicates that the data type is BINARY
.
Some of the OTHER
data type fields might be empty. This happens when Java cannot pass the data through the JDBC/ODBC bridge, for example.
photo
. Type
$matlabroot/toolbox/database/vqb/parsebinary.m
, which displays photo
as a bitmap image.
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
or OTHER
object. Your application might require different manipulations to process the data in MATLAB.
Exporting Multiple New Records from MATLAB | Accessing Metadata |
© 1994-2005 The MathWorks, Inc.