Oracle9i Administrator's Reference
Release 2 (9.2.0.1.0) for UNIX Systems: AIX-Based Systems, Compaq Tru64 UNIX, HP 9000 Series HP-UX, Linux Intel, and Sun Solaris Part No. A97297-01 |
|
This chapter describes Oracle Precompilers and the Oracle Call Interface. It contains the following sections:
Support for 32-Bit and 64-Bit Client Applications (AIX, HP, and Solaris 64-Bit Only)
See Also: "Using Demonstration Tables" for information on using SQL*Plus to create the demonstration tables. |
Oracle precompilers are application-development tools 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 Oracle9i or any other ANSI SQL database management system.
Configuration files for the Oracle precompilers are located in the $ORACLE_HOME/precomp/admin
directory. Table 4-1 lists the names of the configuration files for each precompiler.
Table 4-1 System Configuration Files for Oracle Precompilers
Product | Configuration File |
---|---|
Pro*C/C++ release 9.2.0.1.0 | pcscfg.cfg
|
Pro*COBOL release 9.2.0.1.0 (AIX, HP, Solaris, and Tru64 only) | pcbcfg.cfg
|
Pro*COBOL release 1.8.77.0.0 (AIX, HP, Solaris, and Tru64 only) | pcccob.cfg
|
Pro*FORTRAN release 1.8.77.0.0 (AIX, HP, Solaris, and Tru64 only) | pccfor.cfg
|
Object Type Translator release 9.2.0.1.0 | ottcfg.cfg
|
Oracle SQL*Module for Ada release 9.2.0.1.0 (Solaris 32-bit and AIX only) | pmscfg.cfg
|
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:
$ make -f ins_precomp.mk relink EXENAME=executable
This command creates the new executable in the $ORACLE_HOME/precomp/lib
directory, and then moves it to the $ORACLE_HOME/bin
directory. To create the new executable without moving it to the $ORACLE_HOME/bin
directory, enter the following command:
$ make -f ins_precomp.mk executable
In the preceding examples, executable
is a product executable listed in Table 4-2.
Table 4-2 Products and Their Corresponding Executable
Product | Executable |
---|---|
Pro*C/C++ release 9.2.0.1.0 | proc
|
Pro*COBOL release 9.2.0.1.0 (AIX, HP, Solaris, and Tru64 only) | procob or rtsora
|
Pro*COBOL release 1.8.77.0.0 (AIX, HP, Solaris, and Tru64 only) | procob18 or rtsora
|
Pro*FORTRAN release 1.8.77.0.0 (AIX, HP, Solaris, and Tru64 only) | profor
|
Object Type Translator release 9.2.0.1.0 | ott
|
Oracle SQL*Module for Ada release 9.2.0.1.0 (Solaris 32-bit and AIX only) | modada
|
Table 4-3 lists the location of the precompiler README files. The README files describe changes made to the precompiler since the last release.
Table 4-3 Location of Precompiler README Files
Precompiler | README File |
---|---|
Pro*C/C++ release 9.2.0.1.0 | $ORACLE_HOME/precomp/doc/proc2/readme.doc
|
Pro*COBOL release 9.2.0.1.0 | $ORACLE_HOME/precomp/doc/procob2/readme.doc
|
Pro*COBOL release 1.8.77.0.0 and Pro*FORTRAN release 1.8.77.0.0 | $ORACLE_HOME/precomp/doc/pro1x/readme.txt
|
The following issues are common to all precompilers.
Note: To run Oracle Precompiler demonstrations, Oracle9i must already be installed. |
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, verify that the function or subprogram name in your option file matches the case used in the IAPXTB table.
You can statically or dynamically link Oracle libraries with precompiler and OCI 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 runtime. Libraries that are linked at runtime are called dynamic or shared libraries. The benefits of dynamic linking are:
Smaller disk requirementsMore than one application or invocation of the same application can use the same dynamic library.
Smaller main memory requirementsThe same dynamic library image is loaded into main memory only once and it can be shared by more than one application.
The client shared library is located in the $ORACLE_HOME/lib
directory. If you use the Oracle provided demo_
product
.mk
make file to link an application, the client shared library is linked by default.
You might receive one of the following error message when starting an executable:
On AIX systems:
$ sample1 exec(): 0509-036 Cannot load program ./sample1 because of the following errors: 0509-022 Cannot load library libclntsh.a [shr.o] 0509-026 System error: A file or directory in the pathname does not exist.
On HP systems:
$ sample1 /usr/lib/dld.sl: Can't open shared library: /u01/app/oracle/product/9.2.0.1.0/lib/libclntsh.sl.9.0 /usr/lib/dld.sl: No such file or directory Abort (core dumped)
On Solaris and Linux systems:
$ sample1 ld.so.1: sample1: fatal: libclntsh.so.1.0: can't open file: errno=2 Killed
On Tru64 systems:
$ sample1 /sbin/loader: Fatal Error: Cannot map libclntsh.so Killed
If you receive one of these error messages, set one of the following environment variables, depending on your platform:
On AIX systems:
$ LIBPATH=$ORACLE_HOME/lib:${LIBPATH} $ export LIBPATH
On HP systems (64-bit applications), Linux, Solaris, and Tru64 systems:
$ LD_LIBRARY_PATH=$ORACLE_HOME/lib:${LD_LIBRARY_PATH} $ export LD_LIBRARY_PATH
On HP systems (32-bit applications)
$ SHLIB_PATH=$ORACLE_HOME/lib32:${SHLIB_PATH}$ export SHLIB_PATH
The client shared library is created automatically during installation. If you must recreate the client shared library:
Exit all client applications that use the client shared library, including all Oracle client applications such as SQL*Plus and Recovery Manager.
Log in as the oracle
user and enter:
$ genclntsh
Oracle9i release 2 (9.2.0.1.0) for AIX, HP, and Solaris 64-bit systems provides support for 32-bit and 64-bit client applications. By default, all demonstrations and client applications provided with release 2 (9.2.0.1.0) link and run in 64-bit mode. However, you can build 32-bit and 64-bit client applications in the same ORACLE home directory. You can run both 32-bit and 64-bit applications on Oracle9i release 2 (9.2.0.1.0) for AIX, HP, and Solaris 64-bit systems. The following table lists the 32-bit and 64-bit client shared libraries:
Platform | 32-Bit Client Shared Library | 64-Bit Client Shared Library |
---|---|---|
AIX | $ORACLE_HOME/lib32/libclntsh.a
|
$ORACLE_HOME/lib/libclntsh.a
|
HP | $ORACLE_HOME/lib32/libclntsh.sl
|
$ORACLE_HOME/lib/libclntsh.sl
|
Solaris 64-bit | $ORACLE_HOME/lib32/libclntsh.so
|
$ORACLE_HOME/lib/libclntsh.so |
To implement a mixed word-size installation:
Execute the following command to generate the 32-bit and 64-bit client shared libraries:
$ genclntsh
Include the paths of the required 32-bit and 64-bit shared libraries in one of the following environment variables, depending on your platform:
Platform | Environment Variable |
---|---|
AIX, Solaris 64-bit | LIBPATH |
HP (32-bit client applications) | SHLIB_PATH |
HP (64-bit client applications) | LD_LIBRARY_PATH |
Oracle9i release 2 (9.2.0.1.0) supports both 32-bit and 64-bit Pro*C and Oracle Call Interface (OCI) customer applications.
See Also: $ORACLE_HOME/precomp/demo/demo_proc.mk and $ORACLE_HOME/precomp/demo/demo_proc32.mk files for information on building 32-bit Pro*C applications.
See the |
In Oracle9i release 2 (9.2.0.1.0) for HP and AIX systems, the following directories contain 32-bit executables and libraries:
$ORACLE_HOME/lib32
$ORACLE_HOME/rdbms/lib32
$ORACLE_HOME/hs/lib32
$ORACLE_HOME/network/lib32
$ORACLE_HOME/precomp/lib32
$ORACLE_HOME/bin
Before you use the Pro*C/C++ precompiler, verify that the correct version of the operating system compiler is properly installed.
See Also: Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems for information on the required compiler versions on each platform, and the Pro*C/C++ Precompiler Programmer's Guide for additional information on the Pro*C/C++ precompiler and interface features. |
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. Object programs demonstrate the new Oracle9i Object features. All of the demonstration programs are located in the $ORACLE_HOME/precomp/demo/proc
directory. By default, all programs are dynamically linked with the client shared library.
The programs assume that the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script exist in the SCOTT schema with the password TIGER.
Use the demo_proc.mk
make file, 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, enter the following command:
$ make -f demo_proc.mk sample1
To create all of the C demonstration programs for Pro*C/C++, enter:
$ make -f demo_proc.mk samples
To create all of the C++ demonstration programs for Pro*C/C++, enter:
$ make -f demo_proc.mk cppsamples
To create all of the Object demonstration programs for Pro*C/C++, enter:
$ make -f demo_proc.mk object_samples
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, a message displays requesting you to run it. 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 calldemo
demonstration program and run the required $ORACLE_HOME/precomp/demo/sql/calldemo.sql
script, enter:
$ make -f demo_proc.mk calldemo RUNSQL=run
To create all of the Object demonstration programs and run all corresponding required SQL scripts, enter:
$ make -f demo_proc.mk object_samples RUNSQL=run
You can use the $ORACLE_HOME/precomp/demo/proc/demo_proc.mk
make file to create user programs. The syntax for creating a program with the demo_proc.mk
make file is:
$ make -f demo_proc.mk target OBJS="objfile1 objfile2 ..." EXE=exename
In the preceding example:
target
is the make file target that you want to use
objfilen
is the object file to link the program
exename
is the executable program
For example, to create the program myprog
from the Pro*C/C++ source file myprog.pc
, enter one of the following commands, depending on the source and the type of executable you want to create.
For C source, dynamically linked with the client shared library, enter:
$ make -f demo_proc.mk build OBJS=myprog.o EXE=myprog
For C source, statically linked, enter:
$ make -f demo_proc.mk build_static OBJS=myprog.o EXE=myprog
For C++ source, dynamically linked with the client shared library, enter:
$ make -f demo_proc.mk cppbuild OBJS=myprog.o EXE=myprog
For C++ source, statically linked, enter:
$ make -f demo_proc.mk cppbuild_static OBJS=myprog.o EXE=myprog
Note: On AIX, HP, and Solaris 64-bit systems, thedemo_proc.mk make file builds 64-bit user programs by default. You can also use the demo_proc32.mk make file to build 32-bit user programs. See the make file for more information on creating 32-bit user programs.
|
There are two versions of Pro*COBOL included with this release. Table 4-4 shows the naming conventions for each version.
Table 4-4 Pro*COBOL Naming Conventions
Item | Pro*COBOL Release 9.2.0.1.0 | Pro*COBOL Release 1.8.77.0.0 |
---|---|---|
Executable | procob
|
procob18
|
Demonstration Directory | procob2
|
procob
|
Make file for Merant Server Express COBOL | demo_procob.mk
|
demo_procob18.mk
|
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 located in the $ORACLE_HOME/bin
directory.
Pro*COBOL Environment Variables
This section describes the environment variables required by Pro*COBOL.
For the Merant Server Express COBOL compiler, you must set the COBDIR environment variable and the LD_LIBRARY_PATH, LIBPATH, or SHLIB_PATH environment variable, depending on your operating system.
Set the COBDIR environment variable to the directory where the compiler is installed. For example, if the compiler is installed in the /opt/cobol
directory, enter:
$ COBDIR=${COBDIR}:$/opt/cobol $ export COBDIR
Set the LD_LIBRARY_PATH environment variable to the directory where the compiler is installed. For example, if the compiler is installed in the $COBDIR/coblib
directory, enter:
$ LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$COBDIR/coblib $ export LD_LIBRARY_PATH
Set the LIBPATH environment variable to the directory where the compiler is installed. For example, if the compiler is installed in the $COBDIR/coblib directory, enter:
$ LIBPATH=${LIBPATH}
:$COBDIR/coblib $ exportLIBPATH
Set the SHLIB_PATH environment variable to the directory where the compiler is installed. For example, if the compiler is installed in the $COBDIR/coblib directory, enter:
$ SHLIB_PATH=${SHLIB_PATH}
:$COBDIR/coblib $ exportSHLIB_PATH
If the LD_LIBRARY_PATH, LIBPATH, or SHLIB_PATH environment variable setting does not include the $COBDIR/coblib
directory, one of the following error messages appears when you compile a program:
On Tru64:
14783 rtsora: /sbin/loader: Fatal Error: cannot map libwtc9.so
On AIX, HP, and Solaris:
ld.so.1: rts32: fatal: libfhutil.so.2.0: can't open file: errno=2
Set the PATH environment variable to include the /opt/SUNWnsun/bin
directory, as follows:
$ PATH ${PATH}:/opt/SUNWnsun/bin
$ export PATH
Set the LD_LIBRARY_PATH environment variable to include the /opt/SUNWnsun/bin
directory, as follows:
$ LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/SUNWnsun/bin $ export LD_LIBRARY_PATH
If the LD_LIBRARY_PATH environment variable setting does not include the /opt/SUNWnsun/bin
directory, the following error message appears when you compile a program:
ld.so.1: cobol: fatal: liblicense.so: can't open file: errno=2
Oracle provides its own complete runtime system, called rtsora
, to run dynamically loadable Pro*COBOL programs. Use the rtsora
runtime system in place of the cobrun
runtime system provided by Merant to run dynamically loadable Pro*COBOL programs. If you attempt to run a Pro*COBOL program with cobrun
, you receive the following error:
$ cobrun sample1.gnt Load error : file 'SQLADR' error code: 173, pc=0, call=1, seg=0 173 Called program file not found in drive/directory
Demonstration programs are provided to show the features of the Pro*COBOL precompiler. The demonstration programs are located in either the $ORACLE_HOME/precomp/demo/procob
directory or the $ORACLE_HOME/precomp/demo/procob2
directory, depending on the Pro*COBOL version. By default, all programs are dynamically linked with the client shared library.
The programs assume that the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script exist in the SCOTT schema with the password TIGER.
Use the appropriate make file to create the demonstration programs:
For Pro*COBOL release 9.2.0.1.0, use:
$ORACLE_HOME/precomp/demo/procob/demo_procob.mk
For Pro*COBOL release 1.8.77.0.0, use:
$ORACLE_HOME/precomp/demo/procob/demo_procob18.mk
Note: The following examples assume that you are using the make file for Pro*COBOL release 9.2.0.1.0. |
To precompile, compile, and link the sample1
demonstration program for Pro*COBOL, enter:
$ make -f demo_procob.mk sample1
To create all of the Pro*COBOL demonstration programs, enter:
$ make -f demo_procob.mk samples
To create and run a dynamically loadable sample1.gnt
program to be used with the rtsora
runtime system, enter:
$ make -f demo_procob.mk sample1.gnt $ rtsora sample1.gnt
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, a message displays requesting you to run it. 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 sample9
demonstration program and run the required $ORACLE_HOME/precomp/demo/sql
/sample9.sql
script, enter:
$ make -f demo_procob.mk sample9 RUNSQL=run
To create all of the Pro*COBOL demonstration programs and run all corresponding required SQL scripts, enter:
$ make -f demo_procob.mk samples RUNSQL=run
You can use the appropriate demonstration make file to create user programs, depending on the version of Pro*COBOL you are using. The syntax for creating a program with the demonstration make file is:
For Pro*COBOL release 9.2.0.1.0, enter:
$ make -f demo_procob.mk target COBS="cobfile1 cobile2 ..." EXE=exename
For Pro*COBOL release 1.8.77.0.0, enter:
$ make -f demo_procob18.mk target COBS="cobfile1 cobfile2 ..." EXE=exename
In the preceding examples:
target
is the make file target that you want to use
cobfilen
is the COBOL source file for the program
exename
is the executable program
For example, to create the program myprog
, enter one of the following commands, depending on the source and type of executable you want to create:
For COBOL source, dynamically linked with the client shared library, enter:
$ make -f demo_procob.mk build COBS=myprog.cob EXE=myprog
For COBOL source, statically linked, enter:
$ make -f demo_procob.mk build_static COBS=myprog.cob EXE=myprog
For COBOL source, dynamically loadable for use with rtsora
, enter:
$ make -f demo_procob.mk myprog.gnt
The FORMAT
precompiler option specifies the format of input lines for COBOL. If you specify the default FORMAT=ANSI
, 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 FORMAT=TERMINAL
, columns 1 to 6 are dropped, making column 7 the left-most column.
Before you use the Pro*FORTRAN precompiler, verify that the correct version of the compiler is installed.
See Also: Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems for information on the required compiler versions on each platform, and the Pro*FORTRAN Precompiler Programmer's Guide for additional information on the Pro*FORTRAN precompiler and interface features. |
Demonstration programs are provided to show the features of the Pro*FORTRAN precompiler. All of the demonstration programs are located in the $ORACLE_HOME/precomp/demo/profor
directory. By default, all programs are dynamically linked with the client shared library.
The programs assume that the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script exist in the SCOTT schema with the password TIGER.
Use the demo_profor.mk
make file, located in the $ORACLE_HOME/precomp/demo/profor
directory, to create the demonstration programs. For example, to precompile, compile, and link the sample1
demonstration program, enter:
$ make -f demo_profor.mk sample1
To create all of the Pro*FORTRAN demonstration programs, enter:
$ make -f demo_profor.mk samples
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, a message displays requesting you to run it. 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, enter:
$ make -f demo_profor.mk sample11 RUNSQL=run
To create all of the Pro*FORTRAN demonstration programs and run all corresponding required SQL scripts, enter:
$ make -f demo_profor.mk samples RUNSQL=run
You can use the $ORACLE_HOME/precomp/demo/profor/demo_profor.mk
make file to create user programs. The syntax for creating a program with the demo_proc.mk
make file is:
$ make -f demo_profor.mk target FORS="forfile1 forfile2 ..." EXE=exename
In the preceding example:
target
is the make file target that you want to use
forfilen
is the FORTRAN source for the program
exename
is the executable program
For example, to create the program myprog
, from the Pro*FORTRAN source file myprog.pfo
, enter 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, enter:
$ make -f demo_profor.mk build FORS=myprog.f EXE=myprog
For an executable statically linked, enter:
$ make -f demo_profor.mk build_static FORS=myprog.f EXE=myprog
Before using SQL*Module for Ada, verify that the correct version of the compiler is installed.
See Also: Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems for information on the required compiler versions on each platform, and the SQL*Module for Ada Programmer's Guide for additional information on SQL*Module for Ada. |
Demonstration programs are provided to show the features of SQL*Module for Ada. All of the demonstration programs are located in the $ORACLE_HOME/precomp/demo/modada
directory. By default, all programs are dynamically linked with the client shared library.
The ch1_drv
demonstration program assumes that the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script exist in the SCOTT schema with the password TIGER.
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.
To create all of the SQL*Module for Ada demonstration programs, run the necessary SQL scripts to create the MODTEST user, and create the sample college database, enter:
$ make -f demo_modada.mk all RUNSQL=run
To create a single demonstration program (demohost
), and run the necessary SQL scripts to create the MODTEST user, and create the sample college database, enter:
$ make -f demo_modada.mk makeuser loaddb demohost RUNSQL=run
To create all of the SQL*Module for Ada demonstration programs, without recreating the sample college database, enter:
$ make -f demo_modada.mk samples
To create a single demonstration program (demohost
), without recreating the sample college database, enter:
$ make -f demo_modada.mk demohost
All programs assume that an Oracle Net connect string or alias named INST1_ALIAS is defined and is capable of connecting to the database where the appropriate tables exist.
You can use the $ORACLE_HOME/precomp/demo/modada
/demo_modada.mk
make file to create user programs. The syntax for creating a user program with the demo_modada.mk
make file is:
$ make -f demo_modada.mk ada OBJS="module1 module2 ..." \ EXE=exename MODARGS=SQL*Module_arguments
In the preceding example:
modulen
is a compiled Ada object
exename
is the executable program
SQL*Module_arguments
are the command-line arguments to be passed to the SQL*Module
See Also: SQL*Module for Ada Programmers Guide for more information on SQL*Module for Ada user programs. |
Before you use the Oracle Call Interface (OCI), verify that the correct version of Pro*C/C++ is installed.
See Also: Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems for more information on the required version of Pro*C/C++ for your operating system, and the Oracle Call Interface Programmer's Guide for additional information on the Oracle Call Interface. |
Demonstration programs are provided that show the features of the OCI. There are two types of demonstration programs: C and C++. All of the demonstration programs are located in the $ORACLE_HOME/rdbms/demo
directory. By default, all programs are dynamically linked with the client shared library.
Many of the demonstration programs assume that the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script exist in the SCOTT schema with the password TIGER.
Use the demo_rdbms.mk
make file, located in the $ORACLE_HOME/rdbms/demo
directory, to create the demonstration programs. For example, to compile and link the cdemo1
demonstration program, enter the following command:
$ make -f demo_rdbms.mk cdemo1
To create all of the C demonstration programs for OCI, enter:
$ make -f demo_rdbms.mk demos
To create all of the C++ demonstration programs for OCI, enter:
$ make -f demo_rdbms.mk c++demos
You can use the $ORACLE_HOME/rdbms/demo
/demo_rdbms.mk
make file to create user programs. The syntax for creating a user program with the demo_rdbms.mk
make file is:
$ make -f demo_rdbms.mk target OBJS="objfile1 objfile2 ..." EXE=exename
In the preceding example:
target
is the make file target that you want to use
objfilen
is the object file to link the program
exename
is the executable program
For example, to create the myprog
program from the C/C++ source myprog.c
, enter one of the following commands, depending on the type of executable you want to create:
For C source, dynamically linked with the client shared library, enter:
$ make -f demo_rdbms.mk build OBJS=myprog.o EXE=myprog
For C source, statically linked, enter:
$ make -f demo_rdbms.mk build_static OBJS=myprog.o EXE=myprog
For C++ source, dynamically linked with the client shared library, enter:
$ make -f demo_rdbms.mk buildc++ OBJS=myprog.o EXE=myprog
For C++ source, statically linked, enter:
$ make -f demo_rdbms.mk buildc++_static OBJS=myprog.o EXE=myprog
Note: In the preceding examples, the filemyprog.o is the object file generated by the compiler.
On AIX, HP, and Solaris 64-bit, the |
Oracle Corporation recommends that you use the provided demo_
product
.mk
make files to create user programs as described in the specific product sections of this chapter. If you modify the provided make file, or if you choose to use a custom-written make file, 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 of the symbols are resolved during linking.
The order of the Oracle libraries is essential for the following reasons:
Oracle libraries are mutually referential. Functions in library A call functions in library B, and functions in library B call functions in library A.
The HP and Tru64 linkers are one-pass linkers. The AIX, Linux, and Solaris linkers are two-pass linkers.
If you add your own library to the link line, 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 as nmake
or GNU make
, be aware of how macro and suffix processing differs from the make utility provided with the platform. Oracle make files are tested and are supported with the make
utility for your platform.
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.
Oracle provides the symfind
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:
$ make -f demo_proc.mk sample1 Undefined first referenced symbol in file sqlcex sample1.o sqlglm sample1.o ld: fatal: Symbol referencing errors. No output written to sample1
The error occurs when the linker cannot find a definition for a referenced symbol. If this error message occurs, ensure 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, used to locate the sqlcex
symbol:
$ symfind sqlcex SymFind - Find Symbol <sqlcex> in <**>.a, .o, .so ------------------------------------------------------ Command: /u01/app/oracle/product/9.2.0.1.0/bin/symfind sqlcex Local Directory: /u01/app/oracle/product/9.2.0.1.0 Output File: (none) Note: I do not traverse symbolic links Use '-v' option to show any symbolic links Locating Archive and Object files ... [11645] | 467572| 44|FUNC |GLOB |0 |8 |sqlcex ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./lib/libclntsh.sl [35] | 0| 44|FUNC |GLOB |0 |5 |sqlcex ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./lib/libsql.a
The Oracle libraries provided with this release are thread safe, allowing support for multi-threaded applications.
Oracle9i uses signals for two-task communication. Signals are installed in a user process when you connect to the database and are removed when you disconnect.
Table 4-5 describes the signals that Oracle9i uses for two-task communication.
Table 4-5 Signals for Two-Task Communication
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, 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, you can have multiple signal handlers.
Example 4-1 shows how to set up a signal routine and a catching routine.
Example 4-1 Signal Routine and Catching Routine
/* user side interrupt set */ word osnsui( /*_ word *handlp, void (*astp), char * ctx, _*/) /* ** osnsui: Operating System dependent Network Set User-side Interrupt. Add an ** interrupt handling procedure astp. Whenever a user interrupt(such as a ^C) ** occurs, call astp with argument ctx. Put in *handlp handle for this ** handler so that it may be cleared with osncui. Note that there may be many ** handlers; each should be cleared using osncui. An error code is returned if ** an error occurs. */ /* user side interrupt clear */ word osncui( /*_ word handle _*/ ); /* ** osncui: Operating System dependent Clear User-side Interrupt. Clear the ** specified handler. The argument is the handle obtained from osnsui. An error ** code is returned if an error occurs. */
Example 4-2 shows how to use the osnsui() and the osncui() routines in an application program.
Example 4-2 osnsui() and osncui() Routine Template
/* ** User interrupt handler template. */ void sig_handler() { ... } main(argc, argv) int arc; char **argv; { int handle, err; ... /* set up my user interrupt handler */ if (err = osnsui(&handle, sig_handler, (char *) 0)) { /* if the return value is non-zero, an error has occurred Take appropriate action for the error. */ ... } ... /* clear my interrupt handler */ if (err = osncui(handle)) { /* if the return value is non-zero, an error has occurred Take appropriate action for the error. */ ... } ... }
Oracle XA is the Oracle implementation of the X/Open Distributed Transaction Processing (DTP) XA interface. The XA standard specifies a bi-directional interface between resource managers (for example, Oracle) 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 only when using the XA dynamic registration (Oracle XA switch xaoswd
).
Oracle9i does not support Oracle7 release 7.1.6 XA calls (although it does support Oracle7 release 7.3 XA calls). Therefore, TP-monitor XA applications using Oracle7 release 7.1.6 XA calls must be relinked with the Oracle9i XA library. The Oracle9i XA calls are defined in both the $ORACLE_HOME/lib/
libclntsh.sl
shared library and the $ORACLE_HOME/lib/libclient9.a
static library.
|
![]() Copyright © 1996, 2002 Oracle Corporation All rights reserved |
|