x

How to Link Scanners With Oracle Forms Using the OLE2 Package

by Lora Covrett

Oracle Forms is a software product that allows developers to create a custom interface to the Oracle database. The form has built-in functionality used to perform a variety of interactions with the database, such as creating, reading and updating records. In addition, the programmer can put custom code in the form to manipulate the data either before it is viewed or saved. Object Linking and Embedding is a Microsoft protocol for linking applications. Images can also be scanned and imported into the Oracle Form using OLE. The type of scanner most often used with Oracle Forms is a bar-code scanner.

1

Create an OCX object that contains references to the "Kodak Image Scan Control." Create the new OCX item in the canvas and right-click to insert the scan control objects.

2

Create a scan button with a "when_button_pressed" trigger. Inside the trigger, declare a variable to get the handle of the OLE2 object. Using the handle, call the functions of the "Kodak Image Scan Control" to scan the image into the form. You can set the file type, the compression, location of the scan output and methods that include "startscan," "stopscan" and "showscanpage."

3

Save the scanned image to the local machine's file system. Save the properties of the image to the database. The properties information should include the location of the image and information such as the height, compression, type of image and size of image.

4

Retrieve the image using "read_image_file." Pass the location of the image, the type of image and the table and column name to the "read_image_file" function. The type of image might be "TIFF," "JPG" or "BPM." The following code is an example of how to call the "read_image_file" function where "MyTable" is the name of the database table, and "image_data" is the name of the column in that table: read_image_file('c:\image.jpg', 'JPG', 'MyTable.image_data');

Video of the Day

Brought to you by Techwalla
Brought to you by Techwalla

About the Author

Lora Covrett has been writing professionally since 2006. She has published a humor book, as well as articles for various online publications. Covrett is an IBM-certified database administrator and solution expert. She completed her Bachelor of Science in computer information systems at Devry University.

More Articles

Photo Credits