Oracle Call Interface Getting Started for Windows Platforms Go to Product Documentation Library
Library
Go to books for this product
Product
Go to Contents for this book
Contents
Go to Index
Index



Go to previous file in sequence Go to next file in sequence

Building OCI Applications



Project Files

Project files are often used to assist in building application programs. They guide and control the steps necessary to precompile, compile, and link programs.

MS Visual C/C++ and Borland C/C++ project files help keep executable versions of your programs current when you modify dependent files. These project files are provided with Windows NT/95 sample programs. The MS Visual C/C++ and Borland C/C++ project files:

For more information on the build process, refer to the applicable product documentation for your development environment.

Compiling OCI Applications

To compile the resulting .C source file, switch to the development environment and build the application. Some compiler options are required while others are optional. All options are case-sensitive and are listed below.

Microsoft Compiler Option (16-bit)

Use the following options when compiling an Oracle database application using Microsoft C:

Refer to the documentation provided with your development environment to ensure that all applicable options are selected.

Microsoft Debugging Option (16 and 32-bit)

To debug your application using Microsoft CodeView, use the normal debugging option. For more information, see your Microsoft documentation.

Refer to the documentation provided with your development environment to ensure that all applicable options are selected.

Borland Compiler Options (16 and 32-bit)

Use the following options when compiling an Oracle database application using Borland C.

Borland Debugging Options

To debug your application using Borland Turbo Debugger, use the normal debugging option. For more information, see your Borland documentation.

Linking OCI 32-bit Applications

Link Libraries

When you link OCI applications, you use the following types of library files:

Oracle Libraries

Oracle libraries are required for OCI and/or applications that access an Oracle database.

Runtime Libraries

Runtime libraries are created when you install your C compiler. Runtime libraries are required for any C application, including applications that access the Oracle database.

OCI Dynamic-Link Libraries

The OCI calls are implemented in DLL files that Oracle provides. To use the DLLs, you must link your application with the import libraries (.LIB files) that correspond to the OCI DLLs. Also, you must make sure that the OCI DLL files are installed on the workstation that is using your OCI application.

Applications linked with DLLs provide the following benefits over static libraries:

The required library file is:

Library Type Library Name DLL Name
ORACLE

OCIW32.LIB

OCIW32.DLL

Select the Correct Runtime Library In order to build a Windows NT/95 application, select the appropriate runtime library for the application you are building. See the compiler documentation for your compiler. Also, include the OCIAPR.H header file in your source code. See your compiler's documentation for more information.

Linking Windows NT Applications

To link a Windows NT/95 application, you must use the runtime libraries installed with the C compiler.

Resource File Before linking a Windows NT/95 application, you must build resources such as menus, dialog boxes, cursors, and character strings. You can create resources by using Microsoft's App Studio or Borland's Resource Workshop. For further information, consult your compiler's documentation.

Microsoft Visual C/C++ It is recommended that you include \MSDEV\LIB on the search path if using MSVC 4.x.

Borland Link Options Use the following options to link an Oracle Database application.

OCI Header Files

To use OCI, include OCI header files in your programs. The files are as follows:

OCI Program Calls

The Programmer's Guide to the ORACLE Call Interfaces documents the cursor data area definition and the logon data area definition.

Running OCI Windows NT Applications

WINOCI.C

This program adds new employee records to the personnel database. The program checks the integrity of the database. You can enter as many employee names as you want and perform the SQL commands by selecting the appropriate buttons in the Employee Record box.

The WINOCI program displays a graphical window. Select Connect from the Oracle menu to display the logon dialog box. Type the userid SCOTT, the password TIGER, and the name of the remote Oracle7 Server. Click on OK to connect with the Oracle database.

The following lists the buttons and their definitions available in the programs:

To analyze how an OCI for Windows NT/95 application is built, examine the Microsoft project file by using a text editor to view the steps required to compile, create resources, and link a Windows NT/95 application.

Linking OCI 16-bit Applications

Link Libraries

When you link OCI applications, you use the following types of library files:

Oracle Libraries

Oracle libraries are required for OCI and/or applications that access an Oracle database.

Runtime Libraries

Runtime libraries are created when you install your C compiler. Runtime libraries are required for any C application, including applications that access the Oracle database.

OCI Dynamic-Link Libraries

The OCI calls are implemented in DLL files that Oracle provides. To use the DLLs, you must link your application with the import libraries (.LIB files) that correspond to the OCI DLLs. Also, you must make sure that the OCI DLL files are installed on the workstation that is using your OCI application.

Applications linked with DLLs provide the following benefits over static libraries:

The required library files are listed in the following tables:

Library Type Library Name DLL Name
ORACLE

OCIW16.LIB

OCIW16.DLL

Library Type Microsoft Library Name
Runtime for large model

LLIBCAW.LIB, LLIBCEW.LIB, LIBW.LIB

Runtime for medium model

MLIBCAW.LIB, MLIBCEW.LIB, LIBW.LIB

Library Type BORLAND Library Name
Runtime for large model

CWL.LIB, MATHWL.LIB, IMPORT.LIB

Runtime for medium model

CWM.LIB, MATHWM.LIB, IMPORT.LIB

Select the Correct Runtime Library In order to build a Windows application, select the appropriate runtime library for the application you are building. For example, if you are using the medium model, link with the medium model runtime library. In addition, designate a minimum of 30K of stack space to perform Oracle database operations. Also, include the OCIAPR.H header file in your source code. See your compiler's documentation for more information.

Linking Windows Applications

To link a Windows application, you must use the runtime libraries installed with the C compiler.

You must also link with a module definition file, as described in your compiler's documentation. Windows applications that access an Oracle database require no special module statements. The module definition file for the sample Windows application is named WINSAM.DEF.

The following module statements must appear in the file:

Module Definition
NAME

names the executable.

EXETYPE

identifies the operating system.

DATA

specifies the default attributes for data segments.

CODE

specifies default attributes for code segments.

STACKSIZE

specifies stack size required to run application.

HEAPSIZE

specifies the local heap size.

EXPORTS

defines exported functions.

Example:

The following example presents the contents of a typical module definition file:

Module Definition
NAME

WINOCI

DESCRIPTION

Sample OCI application for Windows

EXETYPE

Windows

DATA

Preload Movable Discardable

CODE

Preload Movable Multiple

STACKSIZE

4096

HEAPSIZE

30000

EXPORTS

Resource File

Before linking a Windows application, you must build resources such as menus, dialog boxes, cursors, and character strings. You can create resources by using Microsoft's App Studio or Borland's Resource Workshop. For further information, consult your compiler's documentation.

Microsoft C Link Options

The following options can be used to link an Oracle database application using Microsoft C:

Option Explanation
/NOD

causes the default runtime libraries to be ignored. You must specify runtime libraries at link time.

/align:16

forces all entry points into a paragraph boundary

/CO

adds Microsoft symbolic debugging information to the executable file (optional).

Borland Link Options

The following options can be used to link an Oracle database application using Borland:

Option Explanation
/L

specifies library search paths. It is recommended that you include \BC5\LIB and %ORACLE_HOME%\OCI73\LIB on the search path.

/v

adds Borland symbolic debugging information to the executable file (optional).

OCI Header Files

To use OCI, include OCI header files in your programs. The files are as follows:

OCI Program Calls

The Programmer's Guide to the ORACLE Call Interfaces documents the cursor data area definition and the logon data area definition.

Running OCI Windows Applications

WINOCI.C

This program adds new employee records to the personnel database. The program checks the integrity of the database. You can enter as many employee names as you want and perform the SQL commands by selecting the appropriate buttons in the Employee Record box.

The WINOCI program displays a graphical window. Select Connect from the Oracle menu to display the logon dialog box. Type the userid SCOTT, the password TIGER, and the name of the remote Oracle7 Server. Click on OK to connect with the Oracle database.

The following lists the buttons and their definitions available in the programs:

To analyze how an OCI for Windows application is built, examine the Microsoft project file by using a text editor to view the steps required to compile, create resources, and link a Windows application.



Go to previous file in sequence Go to next file in sequence
Prev Next
Oracle
Copyright © 1996 Oracle Corporation.
All Rights Reserved.
Go to Product Documentation Library
Library
Go to books for this product
Product
Go to Contents for this book
Contents
Go to Index
Index