How To Use demo_proc.mk To Build A Pro*C Program With OS Authentication (Doc ID 738188.1)

Last updated on JULY 05, 2017

Applies to:

Precompilers - Version 9.2.0.8 and later
Information in this document applies to any platform.
***Checked for relevance on 18th Mar 2016***


Goal

The syntax for using the Oracle demo makefile to build a program where the precompiler must connect to the database is:

make -f demo_proc.mk build EXE=sample1 OBJS=sample1.o PROCFLAGS="sqlcheck=full userid=scott/tiger"

sample1.pc doesn't require connection; this is used only as an example.  The problem if the database schema requires OS Authentication and the OPS$ prefix is used is that the $ is a make metacharacter, so if the userid is ops$abc, the $abc is assumed by the makefile to be some kind of symbol, no translation is found, so the symbol is removed and the following problem occurs (output simplified for illustration and numbered for reference):

(1) $ make -f demo_proc.mk build EXE=sample1 OBJS=sample1.o PROCFLAGS="sqlcheck=full userid=ops$abc/def"
(2) make -f $ORACLE_HOME/precomp/demo/proc/demo_proc.mk PROCFLAGS="sqlcheck=full userid=ops/def" ...
(3) proc sqlcheck=full userid=ops/def iname=sample1 ...
(4) PCC-F-02104, Unable to connect to Oracle

Line 1 is our command.  This is translated by make into a second invokation of the makefile, line 2, where we see $abc has been translated.  There are no further metacharacters on line 2 in (ops/def) so this passes unchanged to line 3 which throws the error on line 4.

A further complication is that the shell translates $$ to the process ID, whereas make translates $$ into a single $.

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms