|
Connecting to Oracle
and other RDBMS Databases
In order to support as many different databases and version
as possible, the code to link to a database is provided in source form
and should be compiled using your own database. The instructions here
are for Oracle 8 on Solaris, but should be easily modified for your own
environment.
Quick Guide to Linking Gsharp to Oracle
- Use your Oracle Pro*C precompiler to generate the Oracle module from
$UNIDIR/misc/Gshap/Oracle.pc
- Compile the Oracle.c that is generated
- Replace the generated Oracle.o in $UNIDIR/lib/libgsh64.a
- Relink Gsharp with the Oracle libraries
Step by Step Guide to Linking Gsharp to Oracle
You should check to see whether Gsharp is already linked with the required
code. On the command line of Gsharp type the following command:
exec sql connect 'user/passwd';
If you receive the message "Gsharp has not been linked with Oracle",
then your copy of Gsharp already contains a compiled Oracle.o and you
just need to relink Gsharp with the Oracle libraries - skip to step 6.
What you will probably see is "Gsharp has not been linked with any RDBMS
code" - start at step 1.
- Set up the Gsharp environment
In a csh use something like "source
/usr/uniras/7v2/uni.login" in a ksh use something like
". ./usr/uniras/7v2/uni.profile"
- Set up the Oracle environment
source $ORACLE_HOME/bin/coraenv or oraenv
- Compile the Gsharp-Oracle interface code $UNIDIR/misc/Gsharp/Oracle.pc
using Oracle's proc compiler.
cd $UNIDIR/misc/Gsharp
proc code=ansi mode=ansi lines=yes iname=Oracle.pc oname=Oracle.c
- Compile the Oracle.c that is generated.
cc -c -DR64 Oracle.c
- Replace the Oracle.o that is generated in $UNIDIR/libgsh64.a.
cp Oracle.o ../lib
cd $UNIDIR/lib
cp libgsh64.a libgsh64orig.a
ar rvl libgsh64.a Oracle.o
- Relink Gsharp with the Oracle libraries instead of the dummy Oracle library.
cd $UNIDIR/bin
Edit Makefile and change the comments around ORALIBS as directed within the Makefile. An example
of the link libraries required for Oracle 8 is given below. Consult the documentation of your
RDBMS product to confirm the exact link procedure required.
unigen Gsharp
Extract from $UNIDIR/bin/Makefile configured for Oracle 8.1.5.0.0 tested on
Sun Solaris 8
...
#ORALIBS= -lorastub64
# If you have the Oracle RDBMS and have licensed the
# Gsharp Database Option, remove the # in front of
# the following lines:
ORALIBS= -L$(ORACLE_HOME)/lib/ \
-lclntsh -lclient8 \
$(ORACLE_HOME)/lib/libsql8.a \
$(ORACLE_HOME)/lib/scorept.o \
$(ORACLE_HOME)/lib/sscoreed.o \
$(ORACLE_HOME)/rdbms/lib/kpudfo.o \
-ln8 -lnl8 -lnro8 \
-ln8 -lnl8 -lclient8 -lvsn8 -lcommon8 -lskgxp8 -lgeneric8 \
-ln8 -lnl8 -lnro8 \
-ln8 -lnl8 -lclient8 -lvsn8 -lcommon8 -lskgxp8 -lgeneric8 \
$(ORACLE_HOME)/lib/libpls8.a \
$(ORACLE_HOME)/lib/libplp8.a \
$(ORACLE_HOME)/lib/libpls8.a \
-ltrace8 -lnls8 \
-lcore8 -lnls8 \
-lcore8 -lnls8 \
-lm -lthread
...
|
|