how to config Pro*C !!!! help me!!
山尖美色 2003-01-15 04:23:41 I have question about pro*c compilation: We have recently installed a Pro*c compiler on HP UNIX 11 box and Oracle 8i. I modified a sample proc program to connect to our database and select several records from a table to verify the pro*c compiler works. Here is how I attempted to compiler the program:
> proc c_test.pc
Result:
Pro*C/C++: Release 8.1.7.0.0 - Production on Fri Dec 7 16:03:41 2001
(c) Copyright 2000 Oracle Corporation. All rights reserved.
System default option values taken from: /u01/app/oracle/product/8.1.7/precomp/a
dmin/pcscfg.cfg
pcscfg.cfg setting are:
sys_include=(/usr/include)
include=(/project/hpux/817/src_000811/precomp/public)
include=/project/hpux/817/src_000811/precomp/hdrs
include=/project/hpux/817/src_000811/tpcc2x_2/src
include=/project/hpux/817/src_000811/precomp/include
include=/project/hpux/817/src_000811/oracore/include
include=/project/hpux/817/src_000811/oracore/public
include=/project/hpux/817/src_000811/rdbms/include
include=/project/hpux/817/src_000811/rdbms/public
include=/project/hpux/817/src_000811/rdbms/demo
include=/project/hpux/817/src_000811/nlsrtl/include
include=/project/hpux/817/src_000811/nlsrtl/public
include=/project/hpux/817/src_000811/network_src/include
include=/project/hpux/817/src_000811/network_src/public
include=/project/hpux/817/src_000811/network/include
include=/project/hpux/817/src_000811/network/public
include=/project/hpux/817/src_000811/plsql/public
include=/project/hpux/817/src_000811/otrace/public
ltype=short
-----------------------------------------------------------------
Why do I get this message "System default option values taken from: /u01/app/oracle/product/8.1.7/precomp/a
dmin/pcscfg.cfg"? Also two other files generated: c_test.c and c_test.lis which should be fine.
So, I compiled the c_test.c program and here is an error message:
> cc c_tesc c
Error message:
cpp: "c_test.c", line 142: error 4036: Can't open include file 'sqlca.h'.
The sqlca.h file is located:
./u01/app/oracle/product/8.1.7/precomp/public/sqlca.h
The stdio.h and other *.h files located:
/usr/include
-------------------------------------------------------------
I have tried to include the sqlca.h file in the psscfg.cfg file, but it doesn't help much. Do I need to set a link in the /usr/include directory to the ./u01/app/oracle/product/8.1.7/precomp/public/ so it recognizes the sqlca.h and others *.h file in this directory? I am a beginner in Proc, please help.
Thank you very much,
Cindy
P.S. Here is the c_test.pc:
===================================================================
#include
#include
#define PWD_LEN 40
typedef char asciiz[PWD_LEN];
EXEC SQL TYPE asciiz IS STRING(PWD_LEN) REFERENCE;
asciiz username;
asciiz password;
struct apps_info
{
asciiz apps_login;
asciiz apps_name;
int apps_sch_ver;
};
void sql_error();
main()
{
struct apps_info *apps_rec_ptr;
if ((apps_rec_ptr =
(struct apps_info *) malloc(sizeof(struct apps_info))) == 0)
{
fprintf(stderr, "Memory allocation error. \n");
exit(1);
}
/* Connect to Oracle. */
strcpy(username, "scott");
strcpy(password, "trigger");
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--");
EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username);
EXEC SQL DECLARE appsinfo_tbl CURSOR FOR
SELECT apps_login, apps_name, apps_sch_ver
FROM apps_info_tbl
WHERE rownum < 11;
EXEC SQL OPEN appsinfo_tbl;
printf("\n\n Application login are-- \n\n");
printf("Apps_login Apps_name Apps_sch_ver\n");
printf("----------- --------------- ------------\n");
EXEC SQL WHENEVER NOT FOUND DO break;
for(;;)
{
EXEC SQL FETCH appsinfo_tbl INTO :apps_rec_ptr;
printf("%-11s %-15s %14d", apps_rec_ptr->apps_login,
apps_rec_ptr->apps_name, apps_rec_ptr->apps_sch_ver);
}
EXEC SQL CLOSE appsinfo_tbl;
EXEC SQL COMMIT WORK RELEASE;
exit(0);
}