Article ID: 185958 - Last Review: August 30, 2004 - Revision: 2.3 How To Use ADO GetChunk/AppendChunk with Oracle for BLOB Data
This article was previously published under Q185958 On This PageSUMMARY The purpose of this article is to demonstrate how to save
and retrieve Binary Large Object (BLOB) data to a LONG RAW datatype column in
an Oracle 7.3 database using the ActiveX Data Objects (ADO) methods GetChunk
and AppendChunk. LONG RAW datatypes are used to store binary data of variable size up to 2 Gb in length. Only one LONG RAW column may be defined per table. LONG RAW columns may not be used in subqueries, functions, expressions, WHERE clauses, or indexes. A table containing a LONG RAW column may not be clustered. Only one LONG RAW column may be defined per table and you cannot have both a LONG and a LONG RAW column define in the same table. It should be noted that it is not recommended to store BLOB data or LONG text data in a table. A more efficient way is to store file pointers in the table that locates the actual files containing the data. MORE INFORMATION The following project has a Picture box, CommonDialog
control, and three Command buttons on the start up form. Results and status are
displayed in the Debug window or the Form's Caption. You must modify the
connection string to match the settings of your Oracle installation. NOTE: For Visual Basic 5.0 users, you need to acquire and install the Microsoft Data Access Components (MDAC) for the sample in this article. Please refer to the article listed in REFERENCES section for information on installing MDAC 2.0. MDAC 2.0 contains ActiveX Data Objects (ADO) version 2.0 and the Microsoft ODBC Driver for Oracle version 2.5. For Visual Basic 6.0 users, ADO 2.0 and the Microsoft ODBC for Oracle driver version 2.5 installs with Visual Basic 6.0. This project uses a table called BlobTable. Following is the script used to create the table and add one row to the table: Application DescriptionThe Visual Basic application has a Picture box control to view the selected picture file (it defaults to .bmp or .ico files), a CommonDialog control to pick a picture file and three Command buttons to control the application flow.The AppendChunk Command button, when clicked, brings up the Open File dialog box allowing you to select a .bmp or .ico file. The code behind the button takes that file and stores it to the BlobTable LONG RAW column using the AppendChunk method. The GetChunk button, when clicked, retrieves the BLOB data in the LONG RAW column, converts the binary data to a BMP file and displays that file in the Picture box control. The third button is to Exit the application. Create the application by following these steps:
The Debug window will have the size of the file you selected along with the ADO connect string. REFERENCES
For additional information, click the following article numbers to view the
articles in the Microsoft Knowledge Base: 322796
(http://support.microsoft.com/kb/322796/EN-US/
)
How To Pass a BLOB as a Parameter to an Oracle Package by Using the .NET Managed Provider for Oracle
192743
(http://support.microsoft.com/kb/192743/EN-US/
)
How To Use ADO GetChunk/AppendChunk with Oracle for TEXT Data
175018
(http://support.microsoft.com/kb/175018/EN-US/
)
How To Acquire and Install the Microsoft Oracle ODBC Driver
For more information, please see the following
articles in the Microsoft Knowledge Base: APPLIES TO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
