IBM Books

Net.Data Programming Guide


Using Large Objects

DB2 supports large objects (LOBs) on an increasing number of platforms. Check your DB2 documentation to see if it supports LOBs. The three types of LOBs DB2 supports are:

When a query returns a LOB, Net.Data saves it in the directory specified by the HTML_PATH configuration variable. Consider system limitations when using LOBs because they can quickly consume resources. Some LOBs, like audio files, require special hardware and software.

LOBs generally contain a file signature in the first few bytes to indicate what type of information the file contains. If a LOB is recognized by Net.Data, the extension is added to the temporary file and to the Net.Data macro variable representing its name. If there is no REPORT block, CLOBs have the .txt extension added to them. These are the recognized LOB formats:

Other file types are not recognized and are not supported. UPDATE and INSERT SQL statements are not supported for any large objects. The first example below displays a picture inline. In the second example, the application user must click on the file name to invoke the viewer.

<IMG SRC="/tmplobs/filename">
<A HREF="/tmplobs/filename">filename</A>

Here is an example of using .WAV files in an application. This file type is not recognized by Net.Data, so a EXEC variable is used to append the extension to the file.

%DEFINE{
docroot="/usr/lpp/internet/server_root/html"
rename=%EXEC "rename $(docroot)$(V3) $(docroot)$(V3).wav"
%}
 
%FUNCTION(DTW_SQL) queryData() {
SELECT Name, IDPhoto, Voice FROM RepProfile
%REPORT{
<P>Here are the images you selected:<P>
%ROW{
$(rename)
$(V1) Voice sample <IMG SRC="$(V2)">
<A HREF="$(V3.wav")>Voice sample</A><P>
%}
%}
%}
 
%HTML(REPORT){
@queryData()
%}

The queryData function returns the following HTML:

<P>Here are the images you selected:<P>
Kinson Yamamoto
<IMG SRC="/tmplobs/p2345n1.gif">
<A HREF="/tmplobs/p2345n2.wav">Voice sample</A><P>
Merilee Lau
<IMG SRC="/tmplobs/p2345n3.gif">
<A HREF="/tmplobs/p2345n4.wav">Voice sample</A><P>

This REPORT block uses the implicit table variables V1, V2, and V3.

Not all Web browsers support graphics and sound. Special hardware and software, such as a sound card and driver, might be required to support the features described here.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]