Skip Headers

Oracle® Objects for OLE Developer's Guide

Part Number B10952-01
Go To Table Of Contents

Example: Using GetChunkByteEx with ASP

'This example is for use with ASP (Active Server Pages)

<%@ LANGUAGE = VBScript %>

<%Response.ContentType = "image/JPEG"%>


Dim OraDatabase, Oradynaset

Dim Chunksize, BytesRead, CurChunkEx

'This assumes a pool of database connections have been created in the global.asa

Set OraDatabase = OraSession.getDatabaseFromPool(10)

'This assumes a table called "art_gallery" and

'displays JPEG images stored in the table

Set OraDynaset = OraDatabase.CreateDynaset("select art from art_gallery where artist = 'Picasso'", 0)

BytesRead = 0

'Reading in 32K chunks

ChunkSize= 32768


BytesRead = OraDynaset.Fields("picture").GetChunkByteEx(CurChunkEx,

i * ChunkSize, ChunkSize)

if BytesRead > 0 then

Response.BinaryWrite CurChunkEx

end if

Loop Until BytesRead < ChunkSize

'Cleanup, remove all local references

Set OraDynaset = Nothing

Set Oradatabase = Nothing


Copyright © 1994, 2003 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents