Solaris and HP-UX Database Access 

Keywords: EOF, Solaris, HP-UX, WODefaultApp

....Overview
....Database Access in Scripted Applications
....Database Access in Compiled Applications under WebObjects 3.5.1
....Database Access in Compiled Applications under WebObjects 3.1

Overview

Under Mach and Windows NT, EOF uses dynamic linking to load the adaptor for your database.  Because this is not possible on Solaris or HP-UX, you will need to statically link in the adaptor for your database.

Database Access in Scripted Applications

Because the WODefaultApp shipped with WebObjects versions 3.1 and 3.51 is not statically linked against any database adaptors, scripted WebObjects apps that use WODefaultApp as their application interface will not be able to access a database.  If you don't want to convert your application to a compiled app, the workaround is to use the application file that comes with WebObjects' DodgeDemo example.  Just rename it to WODefaultApp and replace the original WODefaultApp with it.

Database Access in Compiled Applications under WebObjects 3.5.1

To link a database adaptor into your compiled WebObjects application, you will need to edit your makefile.preamble to statically link the adaptor framework and libraries.

In WebObjects 3.5.1, Apple provides platform- and database-specific makefiles  in /NextDeveloper/Makefiles/PB.makefiles/.  Simply uncomment the line in your makefile.preamble that references the pdo-eoadaptor-linking.make file, and use the FRAMEWORKS keyword to specify the adaptor framework to link against; for example, to link against the Oracle adaptor, you would add FRAMEWORKS += OracleEOAdaptor to your makefile.  For an example of a compiled application that uses the pdo-eoadaptor-linking.make file provided with WebObjects 3.51, please see the DodgeDemo example.

Database Access in Compiled Applications under WebObjects 3.1

In WebObjects 3.1, you will need to add the library and framework paths to your makefile manually.  Below are the makefile keys and values for the most common database adaptors under both Solaris and HP/UX.

Informix Access

To access an Informix database on  Solaris, you will need to set the following keys in your makefiles:

FRAMEWORKS += InformixEOAdaptor

OTHER_LDFLAGS += -L$(INFORMIX_HOME)/lib -L$(INFORMIX_HOME)/lib/esql

OTHER_LIBS += -lsql -lasf -los -lgen -lgls

You must also have the INFORMIXDIR (full path to the Informix home),  INFORMIXSERVER (your server name), and INFORMIX_HOME (usually /opt/informix) environment variables set.  For HP-UX, replace the above OTHER_LIBS line with:

OTHER_LIBS += -lsql -lasf -los -lgen -lgls -lnsl_s -lld -lsec

Sybase Access

For Sybase on Solaris, the equivalent settings are:

FRAMEWORKS += SybaseEOAdaptor

OTHER_LDFLAGS += -L$(SYBASE_HOME)/lib

OTHER_LIBS += -lct -lcs -lcomn -ltcl -ltli -lnsl -lintl -lm

LD_LIBRARY_PATH and SYBASE_HOME must be defined.  For HPUX, replace the above OTHER_LIBS line with:

OTHER_LIBS += -lct -lcs -lcomn -ltcl -linsck -lintl -lm

Oracle Access

For Oracle on Solaris or HPUX, you need to set the following two tags:

FRAMEWORKS += OracleEOAdaptor

OTHER_LDFLAGS += -L$(ORACLE_HOME)/lib

The ORACLE_HOME environment variable must contain the full path to the Oracle server directory.
 You also need to set the OTHER_LIBS tag to an appropriate set of libraries for your platform and Oracle version.

For Oracle 8.0 (with static linking), use these values for Solaris:

OTHER_LIBS += -lclntsh -lcommon -lcore4 -lnlsrtl3

And these values for HPUX:

OTHER_LIBS += -lclntsh \
             $(ORACLE_HOME)/lib/nautab.o \
             $(ORACLE_HOME)/lib/naeet.o \
	      $(ORACLE_HOME)/lib/naect.o \
	      $(ORACLE_HOME)/lib/naedhs.o \
	      -lnetv2 -lnttcp -lnetwork -lncr \
	      -lnetv2 -lnttcp -lnetwork -lclient -lcommon -lgeneric \
	      -lminiserver -lmm -lnlsrtl3  -lcore4 -lnlsrtl3 \
	      -lcore4 -lnlsrtl3 -lnetv2 -lnttcp -lnetwork \
	      -lncr  -lnetv2 -lnttcp -lnetwork -lclient \
	      -lcommon -lgeneric -lminiserver \
	      -lepc -lnlsrtl3  -lcore4 -lnlsrtl3 -lcore4 \
	      -lnlsrtl3 -lclient -lcommon -lgeneric -lminiserver \
	      -lnlsrtl3  -lcore4 -lnlsrtl3 -lcore4 -lnlsrtl3

For Oracle 7.3 with static linking on either platform, use these values:

OTHER_LIBS += -lclntsh -lclient -lsqlnet -lncr -lsqlnet -lclient -lcommon \
              -lgeneric -lsqlnet -lncr -lsqlnet -lclient -lcommon \
              -lgeneric -lepc -lnlsrtl -lcv6 -lcore3 -lnlsrtl3 \
              -lcore3 -lnlsrtl3

For Oracle 7.3 with dynamic linking on either platform, use this value:

OTHER_LIBS += -lclntsh

For an example of how to link in database libraries under WebObjects 3.1, see the makefile.preamble files included in your distribution's DodgeDemo example.