This chapter describes how to use Oracle precompilers and the Oracle Call Interface. It contains the following sections:
Note:
Red Dead Redemption 2 Mac OS. Since we have published Red Dead Redemption for macOS it became the third most downloaded game. It's the most fast-growing title ever published on our website. This is one of the main reasons for which we have started the project to its sequel. Zip-Ada is a free, open-source programming library for dealing with the Zip compressed archive file format. The full sources of Zip-Ada are in Ada, compilable on every compiler and for every system. For more details, read the files zipada.txt and zip.ads from the archive below.
To use the demonstrations described in this chapter, install the Oracle Database Examples included on the Oracle Database 10g Companion CD.6.1 Overview of Oracle Precompilers
Oracle precompilers are application development tools that are used to combine SQL statements for an Oracle Database with programs written in a high-level language. Oracle precompilers are compatible with ANSI SQL and are used to develop open, customized applications that run with Oracle Database or any other ANSI SQL database management system.
It contains the following sections:
6.1.1 Precompiler Configuration Files
Configuration files for the Oracle precompilers are located in the $ORACLE_HOME/precomp/admin
directory. Table 6-1 lists the names of the configuration files for each precompiler.
Table 6-1 System Configuration Files for Oracle Precompilers
Product | Configuration File |
---|---|
Pro*C/C++ |
|
Pro*COBOL (AIX, HP-UX, Solaris, Tru64 UNIX, and zSeries Linux) |
|
Pro*FORTRAN (AIX, HP-UX, Solaris, and Tru64 UNIX) |
|
Object Type Translator |
|
SQL*Module for Ada (AIX) |
|
6.1.2 Relinking Precompiler Executables
Use the $ORACLE_HOME/precomp/lib/ins_precomp.mk
make file to relink all precompiler executables. To manually relink a particular precompiler executable, enter the following command:
This command creates the new executable in the $ORACLE_HOME/precomp/lib
directory, and then moves it to the $ORACLE_HOME/bin
directory.
In the preceding example, replace executable
with one of the product executables listed in Table 6-2.
Table 6-2 Executables for Oracle Precompilers
Product | Executable |
---|---|
Pro*C/C++ |
|
Pro*COBOL (AIX, HP-UX, Linux on POWER, Tru64 UNIX, Solaris SPARC (64-bit), and zSeries Linux) |
|
Pro*COBOL 32-bit (AIX, HP-UX PA-RISC, HP-UX Itanium, Solaris SPARC (64-bit), and zSeries Linux) |
|
Pro*FORTRAN (AIX, HP-UX, Linux on POWER, Solaris, and Tru64 UNIX) |
|
Pro*FORTRAN 32-bit (HP-UX and Linux on POWER) |
|
SQL*Module for Ada (AIX) |
|
6.1.3 Precompiler README Files
Table 6-3 lists the location of the precompiler README files. The README files describe changes made to the precompiler since the last release.
Table 6-3 Location of Precompiler README Files
Precompiler | README File |
---|---|
Pro*C/C++ |
|
Pro*COBOL |
|
Pro*FORTRAN |
|
6.1.4 Issues Common to All Precompilers
The following issues are common to all precompilers:
Uppercase to Lowercase Conversion
In languages other than C, the compiler converts an uppercase function or subprogram name to lowercase. This can cause a
No such user exists
error message. If you receive this error message, then verify that the case of the function or subprogram name in your option file matches the case used in the IAPXTB table.Vendor Debugger Programs
Precompilers and vendor-supplied debuggers can be incompatible. Oracle does not guarantee that a program run using a debugger performs the same way when it is run without the debugger.
Value of
IRECLEN
andORECLEN
parametersThe
IRECLEN
andORECLEN
parameters do not have maximum values.
6.1.5 Static and Dynamic Linking
You can statically or dynamically link Oracle libraries with precompiler and OCI or OCCI applications. With static linking, the libraries and objects of the whole application are linked together into a single executable program. As a result, application executables can become very large.
With dynamic linking, the executing code is partly stored in the executable program and partly stored in libraries that are linked dynamically by the application at run time. Libraries that are linked at run time are called dynamic or shared libraries. The benefits of dynamic linking are:
Reduced disk space requirements: More than one application or call to the same application can use the same dynamic library.
Reduced main memory requirements: The same dynamic library image is loaded into main memory only once, and it can be shared by more than one application.
6.1.6 Client Shared and Static Libraries
The client shared and static libraries are located in the $ORACLE_HOME/lib
or $ORACLE_HOME/lib32
directories. If you use the Oracle-provided demo_
product
.mk
make file to link an application, then the client shared library is linked by default.
If the shared library path environment variable setting does not include the directory that contains the client shared library, then you may see an error message similar to one of the following lines when starting an executable:
To avoid this error, set the shared library path environment variable to specify the appropriate directory. The following table shows sample settings for this environment variable name. If your platform supports both 32-bit and 64-bit applications, then ensure that you specify the correct directory, depending on the application that you want to run.
Platform | Environment Variable | Sample Setting |
---|---|---|
AIX (32-bit applications) | LIBPATH | $ORACLE_HOME/lib32 |
AIX (64-bit applications) | LIBPATH | $ORACLE_HOME/lib |
HP-UX (32-bit applications) | SHLIB_PATH | $ORACLE_HOME/lib32 |
HP-UX (64-bit applications), Linux, and Tru64 UNIX | LD_LIBRARY_PATH | $ORACLE_HOME/lib |
Mac OS X | DYLD_LIBRARY_PATH | $ORACLE_HOME/lib (for 64-Bit libraries)
|
zSeries Linux (31-bit applications), Linux on POWER (32-bit applications), and Solaris (32-bit applications) | LD_LIBRARY_PATH | $ORACLE_HOME/lib32 |
Linux on POWER (64-bit applications), Solaris (32-bit applications) | LD_LIBRARY_PATH_64 | $ORACLE_HOME/lib |
The client shared library is created automatically during installation. If you have to re-create it, then:
Quit all client applications that use the client shared library, including all Oracle client applications such as SQL*Plus and Oracle Recovery Manager.
Log in as the
oracle
user, and run the following command:
Nonthreaded Client Shared Library
Note:
The information in this section applies to HP-UX PA-RISC systems.On HP-UX PA-RISC, you can use a non-threaded client shared library. However, you cannot use this library with any OCI application that uses or has a dependency on threads.
To use this library for applications that do not use threads, run one of the following commands to build your OCI application:
For 32-bit applications:
For 64-bit applications: https://templatepokeroldibslotfreebiesvegas.peatix.com.
6.2 Bit-Length Support for Client Applications
The following table identifies the bit lengths (31-bit, 32-bit, or 64-bit) supported for client applications.
Client Application Type | Supported Platforms |
---|---|
32-bit only | Linux x86, and Solaris x86 |
64-bit only | Tru64 UNIX and Linux Itanium |
32-bit and 64-bit | Linux on POWER, Solaris SPARC, Linux x86-64, and Mac OS X |
31-bit and 64-bit | zSeries Linux |
On AIX, HP-UX, Linux on POWER, Solaris SPARC, and zSeries Linux, all demonstrations and client applications provided with Oracle Database 10g release 2 (10.2) link and run in 64-bit mode. On AIX, Linux on POWER, Solaris SPARC, and HP-UX, you can build 32-bit and 64-bit client applications in the same Oracle home directory. Similarly, on zSeries Linux, you can build 31-bit and 64-bit client applications in the same Oracle home directory.
The following table lists the 32-bit and 64-bit client shared libraries.
Platform | 32-Bit (or 31-Bit) Client Shared Library | 64-Bit Client Shared Library |
---|---|---|
AIX | ||
HP-UX PA-RISC | ||
HP-UX Itanium, Solaris, Linux on POWER, Linux x86-64, and zSeries Linux | Note: On zSeries Linux, the $ORACLE_HOME/lib32 directory contains 31-bit libraries. | |
Mac OS X |
To implement a mixed word-size installation:
Run the following command to generate the 32-bit and 64-bit client shared libraries:
Include the paths of the required 32-bit and 64-bit client shared libraries in one of the following environment variables, depending on your platform:
Platform Environment Variable AIX LIBPATH
HP-UX (32-bit client applications) SHLIB_PATH
HP-UX, Linux on POWER, Linux x86, Linux x86-64, Solaris, and Tru64 UNIX LD_LIBRARY_PATH
Mac OS X DYLD_LIBRARY_PATH
Building 32-Bit Pro*C and OCI Customer Applications
If the operating system supports both 32-bit and 64-bit Pro*C and Oracle Call Interface (OCI) customer applications, then you can find more information about building 32-bit Pro*C and OCI applications in the following files:
For information about. . . | Refer to the Following Make Files. . . |
---|---|
Building 32-bit Pro*C applications (all platforms except Linux on POWER) | $ORACLE_HOME/precomp/demo/proc/demo_proc32.mk |
Building 32-bit OCI applications (all platforms except Linux on POWER) | $ORACLE_HOME/rdbms/demo/demo_rdbms32.mk |
Building 32-bit Pro*C applications (on Linux on POWER) | $ORACLE_HOME/precomp/demo/proc/demo_proc.mk |
Building 32-bit OCI applications (on Linux on POWER) | $ORACLE_HOME/rdbms/demo/demo_rdbms.mk |
Note:
On Linux on POWER, settingCOMPILER_MODE=32
with the make
files specified in the previous table, builds 32-bit objects with GCC.You can the operating system start IBM XL Compiler by setting COMPILER=VAC
.
32-Bit Executables and Libraries
Note:
Information in this section applies to the Mac OS X, AIX, HP-UX, Linux on POWER, Solaris SPARC, and zSeries Linux platforms.If the platform supports both 32-bit and 64-bit applications, then the $ORACLE_HOME/bin
directory contains both 32-bit and 64-bit executables. In addition, the following directories contain 32-bit libraries:
$ORACLE_HOME/lib32
$ORACLE_HOME/rdbms/lib32
$ORACLE_HOME/hs/lib32
$ORACLE_HOME/network/lib32
$ORACLE_HOME/precomp/lib32
6.3 Pro*C/C++ Precompiler
Before you use the Pro*C/C++ precompiler, verify that the correct version of the operating system compiler is properly installed.
See Also:
Oracle Database Installation Guide for information about supported compiler versions
Pro*C/C++ Programmer's Guide for information about the Pro*C/C++ precompiler and interface features
6.3.1 Pro*C/C++ Demonstration Programs
Demonstration programs are provided to show the features of the Pro*C/C++ precompiler. There are three types of demonstration programs: C, C++, and Object programs. All demonstration programs are located in the $ORACLE_HOME/precomp/demo/proc
directory. By default, all programs are dynamically linked with the client shared library.
To run the demonstration programs, the programs require the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script to exist in the JONES schema with the password.
Note:
You must unlock the JONES account and set the password before creating the demonstrations.Use the demo_proc.mk
make file, which is located in the $ORACLE_HOME/precomp/demo/proc/
directory, to create the demonstration programs. For example, to precompile, compile, and link the sample1
demonstration program, run the following command:
Note:
On AIX systems, to ensure that the demonstration programs compile correctly, include the-r
option of the make
command in the following examples. For example:This chapter describes how to use Oracle precompilers and the Oracle Call Interface. It contains the following sections:
Note:
Red Dead Redemption 2 Mac OS. Since we have published Red Dead Redemption for macOS it became the third most downloaded game. It's the most fast-growing title ever published on our website. This is one of the main reasons for which we have started the project to its sequel. Zip-Ada is a free, open-source programming library for dealing with the Zip compressed archive file format. The full sources of Zip-Ada are in Ada, compilable on every compiler and for every system. For more details, read the files zipada.txt and zip.ads from the archive below.
To use the demonstrations described in this chapter, install the Oracle Database Examples included on the Oracle Database 10g Companion CD.6.1 Overview of Oracle Precompilers
Oracle precompilers are application development tools that are used to combine SQL statements for an Oracle Database with programs written in a high-level language. Oracle precompilers are compatible with ANSI SQL and are used to develop open, customized applications that run with Oracle Database or any other ANSI SQL database management system.
It contains the following sections:
6.1.1 Precompiler Configuration Files
Configuration files for the Oracle precompilers are located in the $ORACLE_HOME/precomp/admin
directory. Table 6-1 lists the names of the configuration files for each precompiler.
Table 6-1 System Configuration Files for Oracle Precompilers
Product | Configuration File |
---|---|
Pro*C/C++ |
|
Pro*COBOL (AIX, HP-UX, Solaris, Tru64 UNIX, and zSeries Linux) |
|
Pro*FORTRAN (AIX, HP-UX, Solaris, and Tru64 UNIX) |
|
Object Type Translator |
|
SQL*Module for Ada (AIX) |
|
6.1.2 Relinking Precompiler Executables
Use the $ORACLE_HOME/precomp/lib/ins_precomp.mk
make file to relink all precompiler executables. To manually relink a particular precompiler executable, enter the following command:
This command creates the new executable in the $ORACLE_HOME/precomp/lib
directory, and then moves it to the $ORACLE_HOME/bin
directory.
In the preceding example, replace executable
with one of the product executables listed in Table 6-2.
Table 6-2 Executables for Oracle Precompilers
Product | Executable |
---|---|
Pro*C/C++ |
|
Pro*COBOL (AIX, HP-UX, Linux on POWER, Tru64 UNIX, Solaris SPARC (64-bit), and zSeries Linux) |
|
Pro*COBOL 32-bit (AIX, HP-UX PA-RISC, HP-UX Itanium, Solaris SPARC (64-bit), and zSeries Linux) |
|
Pro*FORTRAN (AIX, HP-UX, Linux on POWER, Solaris, and Tru64 UNIX) |
|
Pro*FORTRAN 32-bit (HP-UX and Linux on POWER) |
|
SQL*Module for Ada (AIX) |
|
6.1.3 Precompiler README Files
Table 6-3 lists the location of the precompiler README files. The README files describe changes made to the precompiler since the last release.
Table 6-3 Location of Precompiler README Files
Precompiler | README File |
---|---|
Pro*C/C++ |
|
Pro*COBOL |
|
Pro*FORTRAN |
|
6.1.4 Issues Common to All Precompilers
The following issues are common to all precompilers:
Uppercase to Lowercase Conversion
In languages other than C, the compiler converts an uppercase function or subprogram name to lowercase. This can cause a
No such user exists
error message. If you receive this error message, then verify that the case of the function or subprogram name in your option file matches the case used in the IAPXTB table.Vendor Debugger Programs
Precompilers and vendor-supplied debuggers can be incompatible. Oracle does not guarantee that a program run using a debugger performs the same way when it is run without the debugger.
Value of
IRECLEN
andORECLEN
parametersThe
IRECLEN
andORECLEN
parameters do not have maximum values.
6.1.5 Static and Dynamic Linking
You can statically or dynamically link Oracle libraries with precompiler and OCI or OCCI applications. With static linking, the libraries and objects of the whole application are linked together into a single executable program. As a result, application executables can become very large.
With dynamic linking, the executing code is partly stored in the executable program and partly stored in libraries that are linked dynamically by the application at run time. Libraries that are linked at run time are called dynamic or shared libraries. The benefits of dynamic linking are:
Reduced disk space requirements: More than one application or call to the same application can use the same dynamic library.
Reduced main memory requirements: The same dynamic library image is loaded into main memory only once, and it can be shared by more than one application.
6.1.6 Client Shared and Static Libraries
The client shared and static libraries are located in the $ORACLE_HOME/lib
or $ORACLE_HOME/lib32
directories. If you use the Oracle-provided demo_
product
.mk
make file to link an application, then the client shared library is linked by default.
If the shared library path environment variable setting does not include the directory that contains the client shared library, then you may see an error message similar to one of the following lines when starting an executable:
To avoid this error, set the shared library path environment variable to specify the appropriate directory. The following table shows sample settings for this environment variable name. If your platform supports both 32-bit and 64-bit applications, then ensure that you specify the correct directory, depending on the application that you want to run.
Platform | Environment Variable | Sample Setting |
---|---|---|
AIX (32-bit applications) | LIBPATH | $ORACLE_HOME/lib32 |
AIX (64-bit applications) | LIBPATH | $ORACLE_HOME/lib |
HP-UX (32-bit applications) | SHLIB_PATH | $ORACLE_HOME/lib32 |
HP-UX (64-bit applications), Linux, and Tru64 UNIX | LD_LIBRARY_PATH | $ORACLE_HOME/lib |
Mac OS X | DYLD_LIBRARY_PATH | $ORACLE_HOME/lib (for 64-Bit libraries)
|
zSeries Linux (31-bit applications), Linux on POWER (32-bit applications), and Solaris (32-bit applications) | LD_LIBRARY_PATH | $ORACLE_HOME/lib32 |
Linux on POWER (64-bit applications), Solaris (32-bit applications) | LD_LIBRARY_PATH_64 | $ORACLE_HOME/lib |
The client shared library is created automatically during installation. If you have to re-create it, then:
Quit all client applications that use the client shared library, including all Oracle client applications such as SQL*Plus and Oracle Recovery Manager.
Log in as the
oracle
user, and run the following command:
Nonthreaded Client Shared Library
Note:
The information in this section applies to HP-UX PA-RISC systems.On HP-UX PA-RISC, you can use a non-threaded client shared library. However, you cannot use this library with any OCI application that uses or has a dependency on threads.
To use this library for applications that do not use threads, run one of the following commands to build your OCI application:
For 32-bit applications:
For 64-bit applications: https://templatepokeroldibslotfreebiesvegas.peatix.com.
6.2 Bit-Length Support for Client Applications
The following table identifies the bit lengths (31-bit, 32-bit, or 64-bit) supported for client applications.
Client Application Type | Supported Platforms |
---|---|
32-bit only | Linux x86, and Solaris x86 |
64-bit only | Tru64 UNIX and Linux Itanium |
32-bit and 64-bit | Linux on POWER, Solaris SPARC, Linux x86-64, and Mac OS X |
31-bit and 64-bit | zSeries Linux |
On AIX, HP-UX, Linux on POWER, Solaris SPARC, and zSeries Linux, all demonstrations and client applications provided with Oracle Database 10g release 2 (10.2) link and run in 64-bit mode. On AIX, Linux on POWER, Solaris SPARC, and HP-UX, you can build 32-bit and 64-bit client applications in the same Oracle home directory. Similarly, on zSeries Linux, you can build 31-bit and 64-bit client applications in the same Oracle home directory.
The following table lists the 32-bit and 64-bit client shared libraries.
Platform | 32-Bit (or 31-Bit) Client Shared Library | 64-Bit Client Shared Library |
---|---|---|
AIX | ||
HP-UX PA-RISC | ||
HP-UX Itanium, Solaris, Linux on POWER, Linux x86-64, and zSeries Linux | Note: On zSeries Linux, the $ORACLE_HOME/lib32 directory contains 31-bit libraries. | |
Mac OS X |
To implement a mixed word-size installation:
Run the following command to generate the 32-bit and 64-bit client shared libraries:
Include the paths of the required 32-bit and 64-bit client shared libraries in one of the following environment variables, depending on your platform:
Platform Environment Variable AIX LIBPATH
HP-UX (32-bit client applications) SHLIB_PATH
HP-UX, Linux on POWER, Linux x86, Linux x86-64, Solaris, and Tru64 UNIX LD_LIBRARY_PATH
Mac OS X DYLD_LIBRARY_PATH
Building 32-Bit Pro*C and OCI Customer Applications
If the operating system supports both 32-bit and 64-bit Pro*C and Oracle Call Interface (OCI) customer applications, then you can find more information about building 32-bit Pro*C and OCI applications in the following files:
For information about. . . | Refer to the Following Make Files. . . |
---|---|
Building 32-bit Pro*C applications (all platforms except Linux on POWER) | $ORACLE_HOME/precomp/demo/proc/demo_proc32.mk |
Building 32-bit OCI applications (all platforms except Linux on POWER) | $ORACLE_HOME/rdbms/demo/demo_rdbms32.mk |
Building 32-bit Pro*C applications (on Linux on POWER) | $ORACLE_HOME/precomp/demo/proc/demo_proc.mk |
Building 32-bit OCI applications (on Linux on POWER) | $ORACLE_HOME/rdbms/demo/demo_rdbms.mk |
Note:
On Linux on POWER, settingCOMPILER_MODE=32
with the make
files specified in the previous table, builds 32-bit objects with GCC.You can the operating system start IBM XL Compiler by setting COMPILER=VAC
.
32-Bit Executables and Libraries
Note:
Information in this section applies to the Mac OS X, AIX, HP-UX, Linux on POWER, Solaris SPARC, and zSeries Linux platforms.If the platform supports both 32-bit and 64-bit applications, then the $ORACLE_HOME/bin
directory contains both 32-bit and 64-bit executables. In addition, the following directories contain 32-bit libraries:
$ORACLE_HOME/lib32
$ORACLE_HOME/rdbms/lib32
$ORACLE_HOME/hs/lib32
$ORACLE_HOME/network/lib32
$ORACLE_HOME/precomp/lib32
6.3 Pro*C/C++ Precompiler
Before you use the Pro*C/C++ precompiler, verify that the correct version of the operating system compiler is properly installed.
See Also:
Oracle Database Installation Guide for information about supported compiler versions
Pro*C/C++ Programmer's Guide for information about the Pro*C/C++ precompiler and interface features
6.3.1 Pro*C/C++ Demonstration Programs
Demonstration programs are provided to show the features of the Pro*C/C++ precompiler. There are three types of demonstration programs: C, C++, and Object programs. All demonstration programs are located in the $ORACLE_HOME/precomp/demo/proc
directory. By default, all programs are dynamically linked with the client shared library.
To run the demonstration programs, the programs require the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script to exist in the JONES schema with the password.
Note:
You must unlock the JONES account and set the password before creating the demonstrations.Use the demo_proc.mk
make file, which is located in the $ORACLE_HOME/precomp/demo/proc/
directory, to create the demonstration programs. For example, to precompile, compile, and link the sample1
demonstration program, run the following command:
Note:
On AIX systems, to ensure that the demonstration programs compile correctly, include the-r
option of the make
command in the following examples. For example:To create all the C demonstration programs for Pro*C/C++, run the following command:
To create all the C++ demonstration programs for Pro*C/C++, run the following command:
To create all the Object demonstration programs for Pro*C/C++, run the following command:
Some demonstration programs require you to run a SQL script, located in the $ORACLE_HOME/precomp/demo/sql
directory. If you do not run the script, then a message prompting you to run it is displayed.
To build a demonstration program and run the corresponding SQL script, include the make
macro argument RUNSQL=run
at the command line. For example, to create the sample9
demonstration program and run the required $ORACLE_HOME/precomp/demo/sql/sample9.sql
script, run the following command:
To create all the Object demonstration programs and run all the required SQL scripts, run the following command:
6.3.2 Pro*C/C++ User Programs
You can use the $ORACLE_HOME/precomp/demo/proc/demo_proc.mk
make file to create user programs. This make file builds either 32-bit or 64-bit user programs. You can also use the demo_proc32.mk
make file to build 32-bit (or 31-bit on zSeries Linux) user programs. The following table shows the make files that you can use to build 32-bit (or 31-bit) and 64-bit user programs with Pro*C/C++.
Platform | 64-bit Make File | 32-Bit Make File |
---|---|---|
AIX, HP-UX, Solaris SPARC, zSeries Linux, and Mac OS X | demo_proc.mk | demo_proc32.mk Note: On zSeries Linux, this make file builds 31-bit user programs. |
Linux x86, and Solaris | NA | demo_proc.mk |
Linux Itanium and Tru64 UNIX | demo_proc.mk | NA |
Linux on POWER | demo_proc.mk | demo_proc.mk Note: |
See Also:
The make file for more information about creating user programsNote:
On AIX systems, to ensure that your programs compile correctly, specify the-r
option for the make
command used in the following examples.To create a program by using the demo_proc.mk
make file, run a command similar to the following:
In this example:
target
is the make file target that you want to useobjfilen
is the object file to link the programexename
is the executable program
For example, to create the program myprog
from the Pro*C/C++ source file myprog.pc
, run one of the following commands, depending on the source and the type of executable that you want to create:
For C source dynamically linked with the client shared library, run the following command:
For C source statically linked with the client shared library, run the following command:
For C++ source dynamically linked with the client shared library, run the following command:
For C++ source statically linked with the client shared library, run the following command:
6.4 Pro*COBOL Precompiler
Note:
Pro*COBOL is not supported on Linux Itanium, Solaris x86, and Mac OS X. On Linux on POWER, Pro*COBOL is supported only on 64-bit.Table 6-4 shows the naming conventions for the Pro*COBOL precompiler.
Table 6-4 Pro*COBOL Naming Conventions
Item | Naming Convention |
---|---|
Executable |
|
Demonstration directory |
|
Make file |
|
Pro*COBOL supports statically linked, dynamically linked, or dynamically loadable programs. Dynamically linked programs use the client shared library. Dynamically loadable programs use the rtsora
executable (or the rtsora32
executable for 32-bit COBOL compilers) located in the $ORACLE_HOME/bin
directory.
6.4.1 Pro*COBOL Environment Variables
This section describes the environment variables required by Pro*COBOL.
6.4.1.1 Acucorp ACUCOBOL-GT COBOL Compiler
Note:
Acucorp ACUCOBOL is not supported on Linux on POWER.To use the Acucorp ACUCOBOL-GT COBOL compiler, you must set the A_TERMCAP
, A_TERM
, PATH
, and LD_LIBRARY_PATH
environment variables. If the LD_LIBRARY_PATH
environment variable setting does not include the correct directory, then an error message similar to the following is displayed when you compile or run a program:
A_TERMCAP and A_TERM
Set the A_TERMCAP
environment variable to specify the location of the a_termcap
file and set the A_TERM
environment variable to specify a supported terminal from that file. For example:
Bourne, Bash, or Korn shell:
C shell:
PATH
Set the PATH
environment variable to include the /opt/COBOL/bin
directory (or the /opt/COBOL31/bin
directory if you are using the 31-bit compiler on zSeries Linux systems):
Bourne, Bash, or Korn shell:
C shell:
LD_LIBRARY_PATH
Note:
On AIX, theLIBPATH
variable is the LD_LIBRARY_PATH
variable equivalent. You must use the LIBPATH
variable on AIX instead of the LD_LIBRARY_PATH
variable in the following commands.Set the LD_LIBRARY_PATH
environment variable to the directory where the compiler library is installed. For example, if the compiler library is installed in the /opt/COBOL/lib
directory, then run the following command:
Bourne, Bash, or Korn shell:
C shell:
6.4.1.2 Micro Focus Server Express COBOL Compiler
To use the Micro Focus Server Express COBOL compiler, you must set the COBDIR
and PATH
environment variables and the shared library path environment variable.
See Also:
The 'Client Shared and Static Libraries' section for information about the shared library path environment variableIf the shared library path environment variable setting does not include the $COBDIR/coblib
directory, then an error message similar to the following is displayed when you compile or run a program:
On Linux:
On Tru64 UNIX:
On HP-UX PA-RISC and Solaris SPARC:
On AIX:
On HP-UX Itanium:
COBDIR
Set the COBDIR
environment variable to the directory where the compiler is installed. For example, if the compiler is installed in the /opt/lib/cobol
directory, then run the following command:
Bourne, Bash, or Korn shell:
C shell:
PATH
Set the PATH
environment variable to include the $COBDIR/bin
directory:
Bourne, Bash, or Korn shell:
C shell:
Shared Library Path
Set the LIBPATH
, LD_LIBRARY_PATH
, or SHLIB_PATH
environment variable to the directory where the compiler library is installed. For example, if the platform uses the LD_LIBRARY_PATH
environment variable and the compiler library is installed in the $COBDIR/coblib
directory, then run the following command:
Bourne, Bash, or Korn shell:
C shell: [ld42] gut reaction mac os.
6.4.2 Pro*COBOL Oracle Runtime System
Oracle provides its own complete run-time system, called rtsora
(or rtsora32
for 32-bit COBOL compilers on 64-bit systems), to run dynamically loadable Pro*COBOL programs. Use the rtsora
(or rtsora32
) run-time system instead of the cobrun
run-time system to run dynamically loadable Pro*COBOL programs. If you attempt to run a Pro*COBOL program with cobrun
, then an error message similar to the following is displayed:
6.4.3 Pro*COBOL Demonstration Programs
Demonstration programs are provided to show the features of the Pro*COBOL precompiler. The demonstration programs are located in the $ORACLE_HOME/precomp/demo/procob2
directory. By default, all programs are dynamically linked with the client shared library.
To run the demonstration programs, the programs require the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script to exist in the JONES schema with the password.
Note:
You must unlock the JONES account and set the password before creating the demonstrations.Use the following make file to create the demonstration programs: Mother love (zener) mac os.
To precompile, compile, and link the sample1
demonstration program for Pro*COBOL, run the following command:
To create the Pro*COBOL demonstration programs, run the following command:
To create and run a dynamically loadable sample1.gnt
program to be used with the rtsora
run-time system, run the following command:
Some demonstration programs require you to run a SQL script, which is located in the $ORACLE_HOME/precomp/demo/sql
directory. If you do not run the script, then a message requesting you to run it is displayed. Sokoban: the rpg mac os.
To build a demonstration program and run the corresponding SQL script, include the make
macro argument RUNSQL=run
in the command. For example, to create the sample9
demonstration program and run the required $ORACLE_HOME/precomp/demo/sql/sample9.sql
script, run the following command:
To create the Pro*COBOL demonstration programs and run all required SQL scripts, run the following command:
6.4.4 Pro*COBOL User Programs
You can use the$ORACLE_HOME/precomp/demo/procob2/demo_procob.mk
make file to create user programs. This make file builds either 32-bit or 64-bit user programs. You can also use the demo_procob_32.mk
make file to build 32-bit (or 31-bit) user programs. The following table shows the make files that you can use to build 32-bit (or 31-bit) and 64-bit user programs with Pro*COBOL.
Platform | 64-bit Make File | 32-Bit Make File |
---|---|---|
AIX, HP-UX, Solaris SPARC, and zSeries Linux | demo_procob.mk | demo_procob_32.mk Note: On zSeries Linux, this make file builds 31-bit user programs. |
Linux x86 | Not applicable | demo_procob.mk |
Tru64 UNIX | demo_procob.mk | Not applicable |
Linux on POWER | demo_procob.mk | demo_procob.mk Note: |
See Also:
The make file for more information about creating user programsKitchen sink mac os. To create a program using the demo_procob.mk
make file, run a command similar to the following:
In this example:
Freeways (itch) mac os.
target
is the make file target that you want to usecobfilen
is the COBOL source file for the programexename
is the executable program
For example, to create the program myprog
, run one of the following commands, depending on the source and type of executable that you want to create:
For COBOL source, dynamically linked with the client shared library, run the following command:
For COBOL source, statically linked, run the following command:
For COBOL source, dynamically loadable for use with
rtsora
(orrtsora32
for 32-bit COBOL compilers), run the following command:
6.4.5 FORMAT Precompiler Option
The FORMAT precompiler option specifies the format of input lines for COBOL. If you specify the default value ANSI
, then columns 1 to 6 contain an optional sequence number, column 7 indicates comments or continuation lines, paragraph names begin in columns 8 to 11, and statements begin in columns 12 to 72.
If you specify the value TERMINAL
, then columns 1 to 6 are dropped, making column 7 the leftmost column.
6.5 Pro*FORTRAN Precompiler
Note:
Pro*FORTRAN is not supported on Linux or Mac OS X.Before you use the Pro*FORTRAN precompiler, verify that the correct version of the compiler is installed. This section contains the following topics:
See Also:
Oracle Database Installation Guide for information about supported compiler versions
Pro*FORTRAN Supplement to the Oracle Precompilers Guide for information about the Pro*FORTRAN precompiler and interface features
6.5.1 Pro*FORTRAN Demonstration Programs
Demonstration programs are provided to show the features of the Pro*FORTRAN precompiler. All demonstration programs are located in the $ORACLE_HOME/precomp/demo/profor
directory. By default, all programs are dynamically linked with the client shared library.
To run the demonstration programs, the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script must exist in the JONES schema with the password.
Note:
You must unlock the JONES account and set the password before creating the demonstrations.To create the demonstration programs, use the demo_profor.mk
make file, located in the $ORACLE_HOME/precomp/demo/profor
directory. For example, to precompile, compile, and link the sample1
demonstration program, run the following command:
To create the Pro*FORTRAN demonstration programs, run the following command:
Some demonstration programs require you to run a SQL script that is located in the $ORACLE_HOME/precomp/demo/sql
directory. If you do not run the script, then a message prompting you to run it is displayed.
To build a demonstration program and run the corresponding SQL script, include the make
macro argument RUNSQL=run
on the command line. For example, to create the sample11
demonstration program and run the required $ORACLE_HOME/precomp/demo/sql/sample11.sql
script, run the following command:
To create the Pro*FORTRAN demonstration programs and run all the required SQL scripts, run the following command:
6.5.2 Pro*FORTRAN User Programs
You can use the $ORACLE_HOME/precomp/demo/profor/demo_profor.mk
make file to create user programs. This make file builds either 32-bit or 64-bit user programs. You can also use the demo_profor_32.mk
make file to build 32-bit user programs. The following table shows the make files that you can use to build 32-bit and 64-bit user programs with Pro*FORTRAN.
Platform | 64-bit Make File | 32-Bit Make File |
---|---|---|
AIX, HP-UX, and Solaris SPARC | demo_profor.mk | demo_profor_32.mk |
Tru64 UNIX | demo_profor.mk | NA |
See Also:
The make file for more information about creating user programsTo create a program using the demo_proc.mk
make file, run a command similar to the following:
In this example:
target
is the make file target that you want to useforfilen
is the FORTRAN source for the programexename
is the executable program
For example, to create the program myprog
from the Pro*FORTRAN source file myprog.pfo
, run one of the following commands, depending on the type of executable that you want to create:
For an executable dynamically linked with the client shared library, run the following command:
For an executable statically linked with the client shared library, run the following command:
6.6 SQL*Module for ADA
Note:
The information in this section applies to the AIX platform.Before using SQL*Module for Ada, verify that the correct version of the compiler is installed.
See Also:
Oracle Database Installation Guide for information about required compiler versions
Oracle SQL*Module for Ada Programmer's Guide for information about SQL*Module for Ada
6.6.1 SQL*Module for Ada Demonstration Programs
Demonstration programs are provided to show the features of SQL*Module for Ada. All demonstration programs are located in the $ORACLE_HOME/precomp/demo/modada
directory. By default, all programs are dynamically linked with the client shared library.
To run the ch1_drv
demonstration program, the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script must exist in the JONES schema with the password.
Note:
You must unlock the JONES account and set the password before creating the demonstrations.The demcalsp
and demohost
demonstration programs require that the sample college database exists in the MODTEST schema. You can use the appropriate make
command to create the MODTEST schema and load the sample college database.
Run the following command to create the SQL*Module for Ada demonstration programs, run the necessary SQL scripts to create the MODTEST user, and create the sample college database:
To create a single demonstration program (demohost
) and run the necessary SQL scripts to create the MODTEST user, and create the sample college database, run the following command:
To create the SQL*Module for Ada demonstration programs, without re-creating the sample college database, run the following command:
To create a single demonstration program (demohost
), without re-creating the sample college database, run the following command:
To run the programs, you must define an Oracle Net connect string or alias named INST1_ALIAS that is capable of connecting to the database where the appropriate tables exist
6.6.2 SQL*Module for Ada User Programs
You can use the $ORACLE_HOME/precomp/demo/modada/demo_modada.mk
make file to create user programs. To create a user program with the demo_modada.mk
make file, run a command similar to the following:
In this example:
modulen
is a compiled Ada objectexename
is the executable programSQL_Module_arguments
are the command-line arguments to be passed to the SQL*ModuleSee Also:
Oracle SQL*Module for Ada Programmer's Guide for information about SQL*Module for Ada
6.7 OCI and OCCI
Before you use the Oracle Call Interface (OCI) or Oracle C++ Call Interface (OCCI), verify that the correct version of C or C++ is installed.
See Also:
Oracle Database Installation Guide for information about supported compiler versions
Oracle Call Interface Programmer's Guide or Oracle C++ Call Interface Programmer's Guide for information about OCI and OCCI
6.7.1 OCI and OCCI Demonstration Programs
Demonstration programs that show the features of OCI and OCCI are provided with the software. There are two types of demonstration programs: C and C++. All demonstration programs are located in the $ORACLE_HOME/rdbms/demo
directory. By default, all programs are dynamically linked with the client shared library.
To run the demonstration programs, the programs require the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script to exist in the JONES schema with the password.
Note:
You must unlock the JONES account and set the password before creating the demonstrations.Use the demo_rdbms.mk
make file, which is located in the $ORACLE_HOME/rdbms/demo
directory, to create the demonstration programs. For example, to compile and link the cdemo1
demonstration program, run the following command:
To create the C demonstration programs for OCI, run the following command:
To create the C++ demonstration programs for OCCI, run the following command:
6.7.2 OCI and OCCI User Programs
You can use the $ORACLE_HOME/rdbms/demo/demo_rdbms.mk
make file to create user programs. This make file builds either 32-bit or 64-bit user programs. You can also use the demo_rdbms32.mk
make file to build 32-bit user programs. The following table shows the make files that you can use to build 32-bit and 64-bit user programs with Pro*FORTRAN.
Platform | 64-bit Make File | 32-Bit Make File |
---|---|---|
AIX, HP-UX, Solaris SPARC, zSeries Linux, and Mac OS X | demo_rdbms.mk | demo_rdbms32.mk Note: On zSeries Linux, this make file builds 31-bit user programs. |
Linux x86, and Solaris x86 | NA | demo_rdbms.mk |
Linux Itanium and Tru64 UNIX | demo_rdbms.mk | NA |
Linux on POWER | demo_rdbms.mk | demo_rdbms.mk Note: |
See Also:
The make file for more information about creating user programsTo create a program by using the demo_rdbms.mk
make file, run a command similar to the following:
In the preceding example:
target
is the make file target that you want to useobjfilen
is the object file to link the programexename
is the executable program
For example, to create the myprog
program from the C source myprog.c
, run one of the following commands, depending on the type of executable that you want to create:
For C source, dynamically linked with the client shared library, run the following command:
For C source, statically linked, run the following command:
For example, to create the myprog
program from the C++ source myprog.cpp
, run one of the following commands, depending on the type of executable that you want to create:
For C++ source, dynamically linked with the client shared library, run the following command:
For C++ source, statically linked, run the following command:
6.8 Oracle JDBC/OCI Programs with a 64-Bit Driver
Note:
The information in this section applies to Mac OS X, AIX, HP-UX, Linux on POWER, Solaris SPARC, and zSeries Linux platforms.
You can use the instructions and make files described in this section to create JDBC/OCI user programs that use a 64-bit driver.
To run JDBC/OCI demonstration programs with a 64-bit driver:
Add
$ORACLE_HOME/jdbc/lib/ojdbc14.jar
to the start of theCLASSPATH
environment variable value for each of the following files:In the
$ORACLE_HOME/jdbc/demo/samples/generic/Makefile
file, modify the JAVA and JAVAC variables to specify the JDK location and the-d64
flag as follows:On Linux on POWER, modify the JAVA and JAVAC variables to specify the JDK location where you have installed the 64 bit JDK as follows:
In the
jdbc/demo/samples/generic/Makefile
file, replace all occurrences ofJDK14_HOME
/bin/javac
with JAVAC, and all occurrences ofJDK14_HOME
/bin/java
with JAVA, except where JAVA and JAVAC are defined.Set the
LD_LIBRARY_PATH_64
environment variable to include the$ORACLE_HOME/lib
directory.Note:
On AIX, theLIBPATH
variable is theLD_LIBRARY_PATH_64
variable equivalent. You must use theLIBPATH
variable on AIX instead of theLD_LIBRARY_PATH_64
variable.On Linux on POWER, you must set the
LD_LIBRARY_PATH
variable instead of theLD_LIBRARY_PATH_64
variable.On Mac OS X, you must set the
DYLD_LIBRARY_PATH
variable instead of theLD_LIBRARY_PATH_64
variable.
6.9 Custom Make Files
Oracle recommends that you use the demo_
product
.mk
make files provided with the software to create user programs as described in the product-specific sections of this chapter. If you modify the provided make file or if you choose to use a custom-written make file, remember that the following restrictions apply:
Do not modify the order of the Oracle libraries. Oracle libraries are included on the link line more than once so that all the symbols are resolved during linking.
Except for AIX, the order of the Oracle libraries is essential on all platforms for the following reasons:
Oracle libraries are mutually referential. For example, functions in library A call functions in library B, and functions in library B call functions in library A.
The HP-UX, Mac OS X, and Tru64 UNIX linkers are one-pass linkers. The AIX, Linux, and Solaris linkers are two-pass linkers.
If you want to add your library to the link line, then add it to the beginning or to the end of the link line. Do not place user libraries between the Oracle libraries.
If you choose to use a
make
utility such asnmake
or GNUmake
, then you must be aware of how macro and suffix processing differs from themake
utility provided with the operating system. Oracle make files are tested and supported with themake
utility.Oracle library names and the contents of Oracle libraries are subject to change between releases. Always use the
demo_
product
.mk
make file that ships with the current release as a guide to determine the required libraries.
6.10 Correcting Undefined Symbols
Oracle provides thesymfind
utility to assist you in locating a library or object file where a symbol is defined. When linking a program, undefined symbols are a common error that produce an error message similar to the following:
The error occurs when the linker cannot find a definition for a referenced symbol. If this error message is displayed, then verify that the library or object file containing the definition exists on the link line and that the linker is searching the correct directories for the file.
The following example shows the output from the symfind
utility, which is used to locate the sqlcex
symbol:
6.11 Multithreaded Applications
The Oracle libraries provided with this release are thread-safe. This enables support for multithreaded applications.
6.12 Using Signal Handlers
Oracle Database uses signals for two-task communication. Signals are installed in a user process when the process connects to the database and are removed when it disconnects.
Table 6-5 describes the signals that Oracle Database uses for two-task communication.
Table 6-5 Signals for Two-Task Communication
Signal | Description |
---|---|
SIGCLD | The pipe driver uses SIGCLD, also referred to as SIGCHLD, when an Oracle process terminates. The operating system kernel sends a SIGCLD signal to the user process. The signal handler uses the |
SIGCONT | The pipe two-task driver uses SIGCONT to send out-of-band breaks from the user process to the Oracle process. |
SIGINT | Two-task drivers use SIGINT to detect user interrupt requests. The Oracle process does not catch SIGINT; the user process catches it. |
SIGIO | Oracle Net protocols use SIGIO to indicate incoming networking events. |
SIGPIPE | The pipe driver uses SIGPIPE to detect end-of-file on the communications channel. When writing to the pipe, if no reading process exists, then a SIGPIPE signal is sent to the writing process. Both the Oracle process and the user process catch SIGPIPE. SIGCLD is similar to SIGPIPE, but it applies only to user processes, not to Oracle processes. |
SIGTERM | The pipe driver uses SIGTERM to signal interrupts from the user to the Oracle process. This occurs when the user presses the interrupt key, Ctrl+c. The user process does not catch SIGTERM; the Oracle process catches it. |
SIGURG | Oracle Net TCP/IP drivers use SIGURG to send out-of-band breaks from the user process to the Oracle process. |
The listed signals affect all precompiler applications. You can install one signal handler for SIGCLD (or SIGCHLD) and SIGPIPE when connected to the Oracle process. If you call the osnsui()
routine to set it up, then you can have more than one signal handle for SIGINT. For SIGINT, use osnsui()
and osncui()
to register and delete signal-catching routines.
You can also install as many signal handlers as you want for other signals. If you are not connected to the Oracle process, then you can have multiple signal handlers.
Example 6-1 shows how to set up a signal routine and a catching routine.
Example 6-1 Signal Routine and Catching Routine
Example 6-2 shows how to use the osnsui()
and the osncui()
routines in an application program.
Mac Os Demo Online
Example 6-2 osnsui() and osncui() Routine Template
Mac Os Simulator Demo
6.13 XA Functionality
Oracle XA is the Oracle implementation of the X/Open Distributed Transaction Processing (DTP) XA interface. The XA standard specifies a bidirectional interface between resource managers that provide access to shared resources within transactions, and between a transaction service that monitors and resolves transactions.
Oracle Call Interface has XA functionality. When building a TP-monitor XA application, ensure that the TP-monitor libraries (that define the symbols ax_reg
and ax_unreg
) are placed in the link line before the Oracle client shared library. This link restriction is required when using the XA dynamic registration (Oracle XA switch xaoswd
).
Ada (combat Demo) Mac Os X
Oracle Database XA calls are defined in both the client shared library (libclntsh.a
, libclntsh.sl
, libclntsh.so
, or libclntsh.dylib
depending on your platform) and the client static library (libclntst10.a
). These libraries are located in the $ORACLE_HOME/lib
directory.