Home » Developer & Programmer » Precompilers, OCI & OCCI » How to compile ProC ? (CentOS5.9 / Oracle10g)
How to compile ProC ? [message #600739] Mon, 11 November 2013 19:03
kikiki8589
Messages: 1
Registered: November 2013
Junior Member
Hi. i'm studying pro c now
I got a error messege... i don't know how to compile ;;
I need your help ..

Source ↓
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlca.h>


EXEC SQL BEGIN DECLARE SECTION;


typedef struct{
int iEmpno;
int iSal;
int iComm;
char cEname[10];
char cJob[10];
char cResult[1024];
}RDATA;


VARCHAR username[20];
VARCHAR passwd[20];


EXEC SQL END DECLARE SECTION;


void Cursor()
{
char sSql[1024];
sprintf(sSql,
"SELECT EMPNO, ENAME, JOB, SAL, COMM "
"FROM EMP "
);
EXEC SQL PREPARE S1 FROM :sSql;
EXEC SQL DECLARE EmpCursor CURSOR FOR S1;


}


void connect_db()
{
strcpy((char*)username.arr,"scott");
username.len=(short)(strlen((char *)username.arr));
strcpy((char*)passwd.arr,"tiger");
passwd.len=(short)(strlen((char *)passwd.arr));


EXEC SQL CONNECT:username IDENTIFIED BY:passwd;


if(sqlca.sqlcode != 0)
{
printf("[ERROR] Connect Error SQL-CODE: %d MSG: %s\n",
sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
exit(1);
}else{
printf("[SUCCESS] Connect DB\n");
}
}


int main()
{
FILE *fp;
RDATA rdata;
int i;
char cBuff[1024];


connect_db();
fp = fopen("test.txt","w");
if(fp == NULL){
printf("file is NULL\n");
}
i = 0;
memset(cBuff,0x00,sizeof(cBuff));
printf("START\n");
while(fgets(cBuff,1024,fp))
{
memset(rdata.cEname,0x00,sizeof(rdata.cEname));
memset(rdata.cJob,0x00,sizeof(rdata.cJob));


Cursor();
EXEC SQL OPEN EmpCursor USING :rdata.iEmpno, :rdata.cEname, :rdata.cJob,
:rdata.iSal, :rdata.iComm;
EXEC FETCH EmpCursor INTO :rdata.cResult;
sprintf(rdata.cResult, "%d | %s | %s | %d | %d\n", rdata.iEmpno, rdata.cEname, rdata.cJob, rdata.iSal, rdata.iComm);
fputs(rdata.cResult,fp);


printf("%d개 \n");
i++;
}
fp(close);


return 0;
}



#> proc test.pc
#> gcc -o test test.c -l$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib -lclntsh
/usr/bin/ld: cannot find -l/u01/app/oracle/product/10.2.0/db_1/precomp/public
collect2: ld returned 1 exit status


#> view pcscfg.cfg
sys_include=(/ade/aime_rdbms_9819/oracle/precomp/public,/usr/include,/usr/lib/gcc-lib/i486-suse-linux/2.95.3/include,/usr/lib/gcc-lib /i386-redhat-linux/3.2.3/include,/usr/lib/gcc-lib/i386-redhat-linux7/2.96/include)
include=(/u01/app/oracle/product/10.2.0/db_1/precomp/public)
include=($ORACLE_HOME/rdbms/demo)
include=($ORACLE_HOME/network/public)
include=($ORACLE_HOME/plsql/public)
ltype=short

#> view .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/u01/app/oracle/product/10.2.0/db_1/precomp/public

# oracle 10g setting
TMP=/tmp; export TMP
TMPDIR=$TMP;
ORACLE_BASE=/u01/app/oracle;
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1;
export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
ORACLE_SID=orcl;
export ORACLE_SID
ORACLE_TERM=xterm;
export ORACLE_TERM
PATH=/usr/sbin:$PATH;
export PATH
PATH=$ORACLE_HOME/bin:$PATH;
export PATH
export LANG=C
export PATH



How to I...TT.TT




Previous Topic: not all variable bound
Next Topic: Rows getting jumbled when fetched using OCIStmtFetch2()
Goto Forum:
  


Current Time: Thu Mar 28 06:11:29 CDT 2024