Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
|
Review the setup information that follows before you begin writing the C++ code or running the sample code provided with Oracle Objects for OLE. Also, see About Sample Code and Applications and Oracle Objects for OLE Files for additional considerations.
Organize Directories
First you will need to locate all the Oracle Objects for OLE C++ DLLs, libraries and headers in directories that are convenient for you. The following listing explains where the Oracle Objects for OLE installation procedure placed these items.
Directory Locations
Note: Use the Options item in the Tools menu of Microsoft Developer Studio to set up the directories which contain the Oracle Objects for OLE files that you need.
Connect to an Oracle Database
You must connect to an Oracle database. Please consult your Oracle documentation on how to do this. You will need a working knowledge of the SQL language because this is the way that you will interact with the Oracle database. Once you have established a connection, you are ready to start writing programs.
Initializing the Class Library
In your program you will need to initialize the class library before using it and uninitialize it before your program exits. This initialization and uninitialization must be done for each application. Normally the initialization is done when the application program starts (for instance, in the application object initialization method) and the uninitialization is done when the program exits (for instance, in the application object destruction). For more information, see the documentation about the OStartup and OShutdown methods.
Accessing a Dynaset through an ODatabase object
The normal use of Oracle Objects for OLE is to obtain access to the data of an Oracle database using a dynaset object. If you consider the relationships between the objects in the class library (see Objects and their Relationships ) you will see that the dynaset is not the topmost object. You will have to create or instantiate some other objects that a dynaset is dependent on. You typically will construct an ODatabase object, which gives you a connection to the database, and then construct an ODynaset object, which will give you access to the data of the database. A Simple Example topic demonstrates this kind of simple access to the database.
Accessing a Dynaset through Managed Dynasets
An alternative approach is to use managed dynasets. In this case you use the OBinder class to take care of the database connection and dynaset. You will use bound objects, objects that are instances of subclasses of OBound, to access the data. The Workbook document gives some examples of using the class library this way. It is particularly suitable for programs that provide a user interface to the database's data.
Introduction to the Class Library
This on-line help system contains a section, About the Class Library, which contains introductory material on the class library, including explanatory subtopics. This system is also the reference manual for the class library, documenting and explaining all the classes and methods.
In addition to the online help system, a Workbook provides some worked-through examples of using the class library. The user-interface widget libraries (OMFC, OMFCxx) are documented in separate documents.
Using Oracle Objects for OLE with Visual Basic or VBA
Please see the Oracle Objects for OLE Help for further details on using Oracle Objects for with Visual Basic (including the Oracle data control) and with other OLE Automation aware applications.