Oracle® Database Administrator’s Reference 10g Release 1 (10.1) for UNIX Systems: AIX-Based Systems, hp HP-UX PA-RISC (64-bit), hp Tru64 UNIX, Linux x86, and Solaris Operating System (SPARC) Part No. B10812-01 |
|
![]() |
![]() |
This chapter describes Oracle Precompilers and the Oracle Call Interface. It contains the following sections:
Note: To use the demonstrations described in this chapter, you must install the Oracle Database Examples included on the Oracle Database 10g Companion CD. |
Calling 32-Bit External Procedures from PL/SQL
See Also: For information about using SQL*Plus to create demonstration tables, see the "Using Demonstration Tables" section. |
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 Oracle Database or any other ANSI SQL database management system.
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++ release 10.1.0.2.0 | pcscfg.cfg |
Pro*COBOL release 10.1.0.2.0 (AIX, HP-UX, Linux x86, Solaris, and Tru64 UNIX only) | pcbcfg.cfg |
Pro*FORTRAN release 1.8.78 (AIX, HP-UX, Solaris, Tru64 UNIX) | pccfor.cfg |
Object Type Translator release 10.1.0.2.0 | ottcfg.cfg |
Oracle SQL*Module for Ada release 10.1.0.2.0 (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 executable
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, executable
is a product executable listed in Table 6-2.
Table 6-2 Products and Their Corresponding Executable
Product | Executable |
---|---|
Pro*C/C++ release 10.1.0.2.0 | proc |
Pro*COBOL release 10.1.0.2.0 (AIX, HP-UX, Linux x86, Solaris, and Tru64 UNIX) | procob or rtsora |
Pro*COBOL release 10.1.0.2.0 32-bit (AIX, HP-UX, and Solaris only) | procob32 or rtsora32 |
Pro*FORTRAN release 1.8.78 (AIX, HP-UX, Solaris, and Tru64 UNIX only) | profor |
Pro*FORTRAN release 1.8.78 32-bit (HP-UX only) | profor32 |
Oracle SQL*Module for Ada release 10.1.0.2.0 (AIX only) | modada |
Table 6-3 lists the location of the precompiler README files. The README files describe changes made to the precompiler since the last release.
The following issues are common to all precompilers.
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 space requirements—More than one application or invocation of the same application can use the same dynamic library.
Smaller 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.
The client shared and static libraries are 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 messages 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-UX systems:
$ sample1 /usr/lib/dld.sl: Can’t open shared library: /u01/app/oracle/product/10.1.0/lib/libclntsh.sl.10.1 /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.10.1: can't open file: errno=2 Killed
On Tru64 UNIX 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:
Platform | Environment Variable | Sample Setting |
---|---|---|
AIX (64-bit applications) | LIBPATH | $ORACLE_HOME/lib |
AIX (32-bit applications) | LIBPATH | $ORACLE_HOME/lib32 |
HP-UX (64-bit applications), Linux, Solaris, and Tru64 UNIX | LD_LIBRARY_PATH | $ORACLE_HOME/lib |
HP-UX (32-bit applications) | SHLIB_PATH | $ORACLE_HOME/lib32 |
The client shared library is created automatically during installation. If you need to recreate it, perform the following:
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 the following command:
$ genclntsh
On HP-UX, 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, use one of the following commands to build your OCI application:
For 32-bit applications:
$ make -f demo_rdbms32.mk build_nopthread EXE=oci02 OBJS=oci02.o
For 64-bit applications:
$ make -f demo_rdbms.mk build_nopthread EXE=oci02 OBJS=oci02.o
On all platforms except Tru64 UNIX and Linux x86, Oracle Database provides support for 32-bit and 64-bit client applications. By default on these platforms, all demonstrations and client applications provided with Oracle Database 10g release 1 (10.1) 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 Oracle Database 10g. 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-UX | $ORACLE_HOME/lib32/libclntsh.sl |
$ORACLE_HOME/lib/libclntsh.sl |
Solaris and HP-UX (IPF) | $ORACLE_HOME/lib32/libclntsh.so |
$ORACLE_HOME/lib/libclntsh.so |
To implement a mixed word-size installation:
To generate the 32-bit and 64-bit client shared libraries, enter the following command:
$ genclntsh
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 and Solaris (64-bit client applications) |
LD_LIBRARY_PATH |
Oracle Database 10g supports both 32-bit and 64-bit Pro*C and Oracle Call Interface (OCI) customer applications. The following table describes where to find more information about building 32-bit Pro*C and OCI applications:
For information about... | See the Following Make Files: |
---|---|
Building 32-bit Pro*C applications | $ORACLE_HOME/precomp/demo/proc/demo_proc32.mk |
Building 32-bit OCI applications | $ORACLE_HOME/rdbms/demo/demo_rdbms32.mk |
For Oracle Database 10g release 1 (10.1.0) on HP-UX 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: For information about the required compiler versions on each platform, see the Oracle Database Installation Guide for UNIX Systems and for more information about the Pro*C/C++ precompiler and interface features, see the Pro*C/C++ Precompiler Programmer's Guide. |
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 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.
To run, the programs require the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script to exist in the SCOTT schema with the password TIGER.
Note: You must unlock the SCOTT account and set the password before creating the demonstrations. |
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 appears 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_proc.mk sample9 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
Note: On all platforms except Linux x86, thedemo_proc.mk make file builds 64-bit user programs by default. On all platforms except Tru64 UNIX, you can also use the demo_proc32.mk make file to build 32-bit user programs. For more information about creating 32-bit user programs, see the make file. |
You can use the $ORACLE_HOME/precomp/demo/proc/demo_proc.mk
make file to create user programs. To create a program using the demo_proc.mk
make file, enter a command similar to the following:
$ make -f demo_proc.mk target OBJS="objfile1 objfile2 ..." EXE=exename
In this 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 that 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 with the client shared library, 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 with the client shared library, enter:
$ make -f demo_proc.mk cppbuild_static OBJS=myprog.o EXE=myprog
Note: This section does not apply to Linux IA-64 systems. |
Table 6-4 shows the naming conventions for the Pro*COBOL precompiler.
Table 6-4 Pro*COBOL Naming Conventions
Item | Pro*COBOL 10.1.0.2.0 |
---|---|
Executable | procob or procob2 |
Demonstration Directory | procob2 |
Make file for Micro Focus Server Express COBOL | demo_procob.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 (or the rtsora32
executable for 32-bit COBOL compilers) located in the $ORACLE_HOME/bin
directory.
This section describes the environment variables required by Pro*COBOL.
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 Linux:
rtsora: error while loading shared libraries: libcobrts_t.so: cannot open shared object file: No such file or directory
On Tru64 UNIX:
356835:rtsora: /sbin/loader: Fatal Error: Cannot map library libcobrts64_t.so.2
On AIX, HP-UX, and Solaris:
ld.so.1: rts32: fatal: libfhutil.so.2.0: can't open file: errno=2
For the Micro Focus 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:
For the Bourne, Bash, or Korn shell:
$ COBDIR=${COBDIR}:/opt/cobol $ export COBDIR
For the C or tcsh shell:
% setenv COBDIR ${COBDIR}:/opt/cobol
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 $COBDIR/coblib
directory, enter:
For the Bourne, Bash, or Korn shell:
$ LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$COBDIR/coblib $ export LD_LIBRARY_PATH
For the C or tcsh shell:
% setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$COBDIR/coblib
Set the LIBPATH environment variable to the directory where the compiler library is installed. For example, if the compiler library is installed in the $COBDIR/coblib
directory, enter:
For the Bourne, Bash, or Korn shell:
$ LIBPATH=${LIBPATH}
:$COBDIR/coblib
$ export LIBPATH
For the C or tcsh shell:
% setenv LIBPATH ${LIBPATH}:$COBDIR/coblib
Set the SHLIB_PATH environment variable to the directory where the compiler library is installed. For example, if the compiler library is installed in the $COBDIR/coblib
directory, enter:
For the Bourne, Bash, or Korn shell:
$ SHLIB_PATH=${SHLIB_PATH}
:$COBDIR/coblib $ exportSHLIB_PATH
For the C or tcsh shell:
% setenv SHLIB_PATH ${SHLIB_PATH}:$COBDIR/coblib
Oracle provides its own complete runtime system, called rtsora
(or rtsora32
for 32 bit systems) to run dynamically loadable Pro*COBOL programs. Use the rtsora
(or rtsora32
for 32-bit COBOL compilers) runtime system instead of the cobrun
runtime system 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 the $ORACLE_HOME/precomp/demo/procob
2
directory. By default, all programs are dynamically linked with the client shared library.
To run the programs, the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script must exist in the SCOTT schema with the password TIGER.
Note: You must unlock the SCOTT account and set the password before creating the demonstrations. |
Use the following make file to create the demonstration programs:
$ORACLE_HOME/precomp/demo/procob2/demo_procob.mk
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 appears 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 required SQL scripts, enter:
$ make -f demo_procob.mk samples RUNSQL=run
Note: On all platforms except Linux x86, thedemo_procob.mk make file builds 64-bit user programs by default. On all platforms except Tru64 UNIX, you can also use the demo_procob_32.mk make file to build 32-bit user programs. For more information about creating 32-bit user programs, see the make file. |
You can use the demonstration make file to create user programs. To create a program using the demonstration make file, enter a command similar to the following:
$ make -f demo_procob.mk target COBS="cobfile1 cobfile2 ..." EXE=exename
In this example:
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 that 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
, (or rtsora32
for 32-bit COBOL compilers) 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 value 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 the value TERMINAL
, columns 1 to 6 are dropped, making column 7 the left-most column.
Note: This section does not apply to Linux systems. |
Before you use the Pro*FORTRAN precompiler, verify that the correct version of the compiler is installed.
See Also: For information about the required compiler versions for each platform, see the Oracle Database Installation Guide for UNIX Systems, and for more information about Pro*FORTRAN precompiler and interface features, see the Pro*FORTRAN Precompiler Programmer's Guide. |
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.
To run the programs, the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script must exist in the SCOTT schema with the password TIGER.
Note: You must unlock the SCOTT account and set the password before creating the demonstrations. |
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 appears 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 required SQL scripts, enter:
$ make -f demo_profor.mk samples RUNSQL=run
Note: On HP-UX systems, thedemo_profor.mk make file builds 64-bit user programs by default. You can also use the demo_profor_32.mk make file on HP-UX systems to build 32-bit user programs. For more information about creating 32-bit user programs, see the make file. |
You can use the $ORACLE_HOME/precomp/demo/profor/demo_profor.mk
make file to create user programs. To create a program using the demo_proc.mk
make file, enter a command similar to the following:
$ make -f demo_profor.mk target FORS="forfile1 forfile2 ..." EXE=exename
In this 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: For more information about the required compiler versions on each platform, see the Oracle Database Installation Guide for UNIX Systems, and for more information about SQL*Module for Ada, see the SQL*Module for Ada Programmer's Guide. |
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.
To run the ch1_drv
demonstration program the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script must exist in the SCOTT schema with the password TIGER.
Note: You must unlock the SCOTT 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.
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 require 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. To create a user program with the demo_modada.mk
make file, enter a command similar to the following:
$ make -f demo_modada.mk ada OBJS="module1 module2 ..." \ EXE=exename MODARGS=SQL*Module_arguments
In this 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: For more information about SQL*Module for Ada user programs, see the SQL*Module for Ada Programmers Guide. |
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: For more information about the required version of C and C++ for your operating system, see the Oracle Database Installation Guide for UNIX Systems. For more information about the OCI and OCCI, see the Oracle Call Interface Programmer's Guide or the Oracle C++ Call Interface Programmer’s Guide. |
Demonstration programs that show the features of OCI and OCCI are provided. 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.
To run the demonstration programs, the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql
script must exist in the SCOTT schema with the password TIGER.
Note: You must unlock the SCOTT account and set the password before creating the demonstrations. |
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 OCCI, enter:
$ make -f demo_rdbms.mk c++demos
Note: On all platforms except Linux x86, thedemo_rdbms.mk make file builds 64-bit user programs by default. On all platforms except Tru64 UNIX, you can use the demo_rdbms32.mk make file to build 32-bit user programs. For more information about creating 32-bit user programs, see the make file. |
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 source myprog.c
, enter 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, 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 example, to create the myprog
program from the C++ source myprog.cpp
, enter 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, 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: You can also use the instructions and make files described in this section to create your own JDBC/OCI user programs that use a 64-bit driver. |
To run JDBC/OCI demonstration programs with a 64-bit driver, follow these steps:
Add $ORACLE_HOME/jdbc/lib/ojdbc14.jar
to the start of the CLASSPATH environment variable for each of the following files:
jdbc/demo/samples/jdbcoci/Makefile jdbc/demo/samples/generic/Inheritance/Inheritance1/Makefile jdbc/demo/samples/generic/Inheritance/Inheritance2/Makefile jdbc/demo/samples/generic/Inheritance/Inheritance3/Makefile jdbc/demo/samples/generic/JavaObject1/Makefile jdbc/demo/samples/generic/NestedCollection/Makefile
In the $ORACLE_HOME/jdbc/demo/samples/generic/Makefile
file, modify the JAVA and JAVAC variables to specify the JDK location as follows, depending on your platform:
For Solaris and HP 64-bit, change JAVA and JAVAC to the following, specifying the -d64
flag:
JAVA=${ORACLE_HOME}/java/bin/java -d64 JAVAC=${ORACLE_HOME}/java/bin/javac -d64
For AIX, change JAVA and JAVAC to the following, where JDK14_HOME
is the directory in which the 64-bit JDK is installed:
JAVA=$(JDK14_HOME
)/bin/java JAVAC=$(JDK14_HOME
)/bin/javac
In the jdbc/demo/samples/generic/Makefile
file, replace all occurrences of JDK14_HOME
/bin/javac
with JAVAC, and all occurrences of JDK14_HOME
/bin/java
with JAVA, except where JAVA and JAVAC are defined.
Set the shared library path environment variable for your platform to include the following directories:
Platform | Environment Variable | Directories to Include |
---|---|---|
AIX | LIBPATH | $ORACLE_HOME/lib |
HP-UX | SHLIB_PATH | $ORACLE_HOME/lib :$JDK14HOME/jre/lib/PA_RISC2.0W/server |
Solaris | LD_LIBRARY_PATH | $ORACLE_HOME/lib |
Oracle recommends that you use the provided demo_
product
.mk
make files 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, 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-UX and Tru64 UNIX 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.
The Oracle libraries provided with this release are thread safe, allowing support for multi-threaded applications.
Oracle Database uses signals for two-task communication. Signals are installed in a user process when it 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
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 6-1 shows how to set up a signal routine and a catching routine.
Example 6-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 6-2 shows how to use the osnsui() and the osncui() routines in an application program.
Example 6-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 bidirectional 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
).
Oracle Database XA calls are defined in both the client shared library (libclntsh.a
, libclntsh.sl
, or libclntsh.so
depending on your platform) and the client static library (libclntst.a
). These libraries are located in the $ORACLE_HOME/lib
directory.
Note: This section applies to AIX, HP-UX, and Solaris only. |
The 64-bit external procedure executable (extproc) and the 32-bit external procedure executable (extproc32)
are installed in the $ORACLE_HOME/bin
directory. By default, the extproc
executable is enabled to run 64-bit external procedures on AIX, HP-UX, Solaris, and Tru64 UNIX. To enable 32-bit external procedures:
Set the value of the PROGRAM parameter in the listener.ora
file:
(PROGRAM=extproc32)
Include the $ORACLE_HOME/lib32
directory in one of the following environment variables, depending on your platform:
Platform | Environment Variable |
---|---|
AIX | LIBPATH |
HP-UX | SHLIB_PATH |
Solaris | LD_LIBRARY_PATH |
Restart the listener.
Note: You can configure a listener to run either 32-bit or 64-bit external procedures, but not both at the same time. However, you can configure two listeners if you need to support both 32-bit and 64-bit external procedures. |