Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: OCI within a C Cartridge

Re: OCI within a C Cartridge

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 05 Apr 1999 01:09:11 GMT
Message-ID: <37120c48.18286344@192.86.155.100>


A copy of this was sent to hagai sagi <hagais_at_hotmail.com> (if that email address didn't require changing) On Mon, 05 Apr 1999 01:28:45 +0100, you wrote:

>Im writing a c cartridge in Oracle Application Server.
>The system is running on sun solaris 2.6 .
>I would like to combine OCI (Oracle Class Interface) into the c
>cartridge in order to make a connection to the database (oracle).
>In order to do it I have to create a Makefile.
>How should the makefile look like?
>I would like to receive a fool example of the makefile.


You don't give versions of software so i'll post one example i have. Its for Oracle8.0 and OAS3.x on solaris 2.x. With this combination, you have to link in a 'special' way since OAS3 is linked against 7.3.2.3 and your cartridge is linking against 08. You cartridge is dynamically loaded by OAS3 which already has Oracle support files loaded -- we need to make sure our cartridge gets the Oracle8 stuff. In 2.x this would apply as well. In 4.x this does not necessarily apply since OAS4 is linked against O8 itself.

# This is set to the Oracle8 ORACLE_HOME, Not the Oracle7 oracle home that
# OWAS3.x is installed into.

ORACLE_HOME=/user2/oracle8

# This is set to the $ORACLE_HOME/ows/3.0/public directory where the OWAS3.0
# code is installed into. WEBTOP will point to the directory that contains
# the WRBSDK include (header) files.

WEBTOP = /user2/oracle73/ows/3.0/public

# The name of the .so file you are creating should go here
TARGET=o8demo.so
all: $(TARGET)

# The inclusion of this file will ensure we get the inclusive list of
# libraries needed to link with. We use many symbolics this makefile
# gives us

include $(ORACLE_HOME)/rdbms/demo/demo_rdbms.mk

# This is the standard location for WRBSDK include files, this
# should not be changed

INCHOME = $(WEBTOP)
# This is the standard list of directories Oracle8 include files are
# located in. This should not be modified
DB_INCS=-I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/rdbms/public \

        -I$(ORACLE_HOME)/plsql/public -I$(ORACLE_HOME)/network/public

# This is the list of object code that will result from compiling your
# C code. The rules for converting .c into .o files is contained in
# the demo_rdbms.mk file above.

OBJS = o8main.o o8code.o

# the following line does all the work. If you have defined TARGET and OBJS
# above, all of your c code will be compiled and then linked together to
# generate the target .so file

$(TARGET): $(OBJS)
    ld -o $@ -G -B symbolic $(OBJS) \

        -L$(ORACLE_HOME)/lib $(SSDBED) $(DEF_ON) $(OCISTATICLIBS)

# We need to define the flags that will be passed to the C compiler to
# turn our .c files into .o files. You may modify this line to add any
# options to cc you feel you need.

CFLAGS=-I. -I$(INCHOME) $(DB_INCS) -Wall  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sun Apr 04 1999 - 20:09:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US