Oracle® Objects for OLE Developer's Guide 10g Release 2 (10.2) Part Number B14309-01 |
|
|
View PDF |
This chapter introduces Oracle Objects for OLE (OO4O).
This chapter contains these topics:
Oracle Objects for OLE (OO4O) allows you to access data stored in Oracle databases with any programming or scripting language that supports Microsoft COM Automation and ActiveX technology. This includes Visual Basic, Visual C++, Visual Basic for Applications (VBA), IIS Active Server Pages (VBScript and JavaScript), and others.
Figure 1-1 illustrates the software layers that comprise the OO4O product.
OO4O provides the following:
The OO4O In-Process Automation Server is a set of COM Automation Objects for connecting to Oracle databases, executing SQL statements and PL/SQL blocks, and accessing the results.
Figure 1-2 illustrates the object model that comprise the OO4O product.
Unlike other COM-based database connectivity APIs, such as Microsoft ActiveX Data Objects (ADO), the OO4O Automation Server was created specifically for use with Oracle databases. It provides an optimized API for accessing features that are unique to the Oracle database and are otherwise cumbersome or unavailable from ODBC or OLE DB components.
OO4O provides key features for accessing Oracle databases efficiently and easily in environments ranging from the typical two-tier client/server applications, such as those developed in Visual Basic or Excel, to application servers deployed in multitiered application server environments such as Web server applications in Microsoft Internet Information Server (IIS) or Microsoft Transaction Server (MTS).
See Also:
"Introduction to Automation Objects"Features include:
Oracle 10g is grid enabled, allowing developers to take full advantage of grid support without changes being required to existing code.
Tunable client-side, scrollable and updatable cursors for easy and efficient access to result sets of queries.
PL/SQL support for execution of PL/SQL anonymous blocks and stored procedures. This includes support for the Oracle data types, such as PL/SQL cursors, that are needed for parameters of PL/SQL stored procedures.
Support for array fetches, updates, and inserts resulting in reduced network round-trips.
Connection pooling to allow development of scalable middle tier application components, such as IIS Active Server Pages, that use and serve dynamic content stored in Oracle databases.
Support for COM+ and Microsoft Transaction Server (MTS) co-ordinated transactions.
Seamless access to instances of advanced Oracle data types:
Object references (REFs)
Object instances (Objects)
Nested tables
VARRAY
s
BLOB
s, CLOB
s, NCLOB
s, and BFILE
s
XML generation.
Full support for advanced queuing.
Support for publishing, detecting, and subscribing to database events.
Support for asynchronous processing of SQL statements and PL/SQL blocks.
Easy to use interface for describing schema objects.
The Oracle code wizard for stored procedures, which automatically generates OO4O code to execute PL/SQL or Java stored procedures.
Thread safety, allowing safe access to automation objects in multithreaded environments.
Oracle Data Control is an ActiveX control that is designed to simplify the exchange of data among an Oracle database and visual controls such as edit, text, list, and grid controls in Visual Basic and other development tools that support custom controls.
A data control enables you to perform most data access operations without writing any code. To create a dynaset with a data control, set the Connect
, DatabaseName
, and RecordSource
properties, and execute the Refresh
command.
A data control enables you to bind it to other controls that display a field, a record, or multiple records of the underlying dynaset. When record movement occurs, data in bound controls stay synchronized with the current record of the dynaset. If a user changes data in a control that is bound to a data control, the changes are automatically reflected in the underlying dynaset and database.
The Oracle Data Control is compatible with the Microsoft data control included with Visual Basic. If you are familiar with the Visual Basic data control, learning to use Oracle Data Control is quick and easy. Communication between data-aware controls and a Data Control is governed by a protocol specified by Microsoft.
The Oracle Objects for OLE C++ Class Library is a collection of C++ classes that provide programmatic access to the OO4O Automation server. Although the class library is implemented using OLE Automation, neither the OLE development kit nor any OLE development knowledge is necessary to use it. This library helps C++ developers avoid writing COM client code to access the OO4O interfaces.
In addition to the object classes, the class library provides a bound class, which allows controls such as text and list boxes to be linked directly to a field of a dynaset (columns of a table in the database). The bound class supports late, run-time binding, as is available in Visual Basic. The Oracle Objects for OLE C++ Class Library is supported for Microsoft Visual C++ and the Microsoft Foundation Classes for the bound class.
This section discusses the required setups for using Oracle Objects for OLE.
Oracle Objects for OLE can be installed in multiple Oracle homes, starting with Oracle Database 10g. However, being a COM component, only one instance can be active on the computer. This means that the current (latest) installation renders the previous one inactive. You can switch Oracle homes by using the Oracle installer.
The following system requirements are necessary to install Oracle Objects for OLE:
Windows XP, Windows 2000, or Windows Server 2003
A local or remote Oracle database (Oracle8i, Oracle9i, or Oracle Database 10g)
Oracle networking if connecting to a remote Oracle database
Required Support Files (RSF) 10.1. Oracle Universal Installer ensures that the RSFs are installed as part of the OO4O installation.
The OO4O automation server requires an application that supports COM Automation such as:
Microsoft Visual Basic
Microsoft Excel
Microsoft Access
Microsoft Internet Information Server (IIS)
Borland Delphi
The following other requirements may be necessary:
The Oracle Data Control requires Visual Basic.
The Oracle Objects for OLE C++ Class Library requires Microsoft Visual C++ Version 6.0 or later.
The OO4O Code Wizard requires Visual Basic 6. Visual Basic 6 must be installed before installing the Code Wizard.
The Oracle In-Process Server Type library (oip10.tlb)
must be referenced when an OO4O Visual Basic project is developed.
To do this, select References from the Project menu (VB 5.0/6.0) and check the box next to the Oracle In-Process Server 5.0 Type Library, which should be pointing to the ORACLE_BASE\ORACLE_HOME
\bin\oip10.tlb
file. See "Using Oracle Objects for OLE Automation with Visual Basic" for detailed information.
See Also:
"Oracle Objects for OLE Redistributable Files" and "Troubleshooting" for further information on Oracle Objects for OLE requirementsAs part of the OO4O installation, the following directories are created and contain the corresponding files:
ORACLE_BASE\ORACLE_HOME
\OO4O
- SQL scripts and constants file
ORACLE_BASE\ORACLE_HOME
\OO4O\CPP
- Libraries, include files, DLLs, and source for the class library
ORACLE_BASE\ORACLE_HOME
\OO4O\CPP\MFC
- Libraries, include files, and source for the MFC Bound Class Library
ORACLE_BASE\ORACLE_HOME
\OO4O\EXCEL\SAMPLES
- Excel samples
ORACLE_BASE\ORACLE_HOME
OO4O\VB\SAMPLES
- Visual Basic samples
ORACLE_BASE\ORACLE_HOME
\OO4O\VB\SAMPLES\QT
- Visual Basic Quick Tour guide
ORACLE_BASE\ORACLE_HOME
\OO4O\IIS\SAMPLES
- IIS samples
ORACLE_BASE\ORACLE_HOME
\OO4O\codewiz
- OO4O Code Wizard samples
Oracle provides support information for components on various platforms, lists compatible client and database versions, and identifies patches and workaround information.
Find the latest certification information at: http://metalink.oracle.com/
You must register online before using OracleMetaLink. After logging in, select Certify & Availability from the left-hand column. From the Product Lifecycle page, select the Certifications button. Other Product Lifecycle options include Product Availability, Desupport Notices, and Alerts.
This section discusses files that can be redistributed or updated on a computer that belongs to an end user or a developer.
If you cannot guarantee that your end users have the current release of Oracle Objects for OLE installed on their computers, you need to redistribute specific files that are part of Oracle Objects for OLE along with your OO4O application. A typical scenario might be if OO4O is installed as a patch without use of Oracle Universal Installer.
Table 1-1 lists the Redistributable file locations with comments and further actions that are needed.
Table 1-1 Redistributable File Locations
Files | Place in Directory | Further Actions | Comments |
---|---|---|---|
oip10.dll |
ORACLE_BASE\ ORACLE_HOME \bin |
Execute the following from a command prompt:
|
None. |
oip10.tlb |
ORACLE_BASE\ ORACLE_HOME \bin |
None. | None. |
oraansi VER .dll |
ORACLE_BASE\ ORACLE_HOME \bin |
None. | Change VER to the current version. |
oo4oparm.reg |
ORACLE_BASE\ ORACLE_HOME \oo4o |
Edit for the correct ORACLE_HOME location and HOME ID on your computer. Execute the following from a command prompt: drive:\path>
|
File provided to register OO4O configuration information. |
oiplang.msb |
ORACLE_BASE\ ORACLE_HOME \oo4o\mesg |
None. | This message file is language-specific. oipus.msb is the English version, and oipja.msb is the Japanese version. |
oraclm32.dll
(for Microsoft VC++) or
|
ORACLE_BASE\ ORACLE_HOME \bin |
For oradc.ocx , execute:
|
Distribute the files that correspond to the development software used in your application. |
Additionally, ensure that the system requirements described in "Overview of Oracle Objects for OLE" are met.
You must also distribute the files from the following list that correspond to the development software you used to build your application:
oraclm32.dll
(for Microsoft Visual C++)
oradc.ocx
The oo4oparm.reg
file is provided to register OO4O configuration information. Review this file and edit it as necessary to reflect the correct ORACLE_HOME
location and HOME
ID
on your computer. To register oip10.dll
and enter the OO4O configuration information for oo4oparm.reg
in the registry, execute the following from a command prompt:
drive
:\
path
>
regsvr32.exe oip10.dll
drive
:\
path
>
oo4oparm.reg
The message file oiplang.msb
should also be provided and copied to the ORACLE_BASE\ORACLE_HOME
\oo4o\mesg
directory. The message file is specific to a language. For example, oipus.msb
is the English version and oipja.msb
is the Japanese version.
Note:
Oracle Data Control (oradc.ocx
) must be registered to function. The OLE Control Extension (OCX) can be registered by executing the following at the command prompt:
drive
:\
path
>
regsvr32.exe oradc.ocx
See Also:
"Oracle Data Control"