Home » Developer & Programmer » Precompilers, OCI & OCCI » Compile pro*c file with "-DDAEMON -DBACKGROUND" option on Solaris (Pro*C, Oracle 10g, Solaris 10)
|
Re: Compile pro*c file with "-DDAEMON -DBACKGROUND" option on Solaris [message #345940 is a reply to message #345500] |
Fri, 05 September 2008 06:31  |
cwchan
Messages: 2 Registered: September 2008
|
Junior Member |
|
|
Here is some update, it turns out that is not related to the -DDAEMON -DBACKGROUND option, and is still unable to connect to Oracle.
source
==========================
#include "genConst.h"
#include "genInclude.h"
EXEC SQL INCLUDE SQLCA;
int main (int argc, char* argv[])
{
exec sql begin declare section;
char luid20;
char dbname20;
int lnCnt = 0;
exec sql end declare section;
printf("Testmain.cpp : main() Testing 1 \n");
strcpy(luid, "/");
strcpy(dbname, "TESTDB");
printf("Testmain.cpp : main() Testing 2 \n");
exec sql connect :luid at :dbname;
printf("Testmain.cpp : main() Testing 3 \n");
EXEC SQL
EXECUTE
BEGIN
select count(*)
into :lnCnt
from testtable;
END;
END-EXEC;
printf("Testmain.cpp : main() Testing 4 \n");
if (sqlca.sqlcode != 0)
{
printf("Testmain.cpp : main() Testing 5 %i \n", lnCnt);
printf("%.*s \n",sqlca.sqlerrm.sqlerrml,sqlca.sqlerrm.sqlerrmc);
return -1;
}
else
{
printf("Testmain.cpp : main() Testing 6 %i \n", lnCnt);
}
printf("Testmain.cpp : main() Testing 7 \n");
return 0;
}
compilation command
==========================================================
$ORACLE_HOME/bin/proc $TEST_HOME/Testmain CODE=CPP CPP_SUFFIX=cpp SQLCHECK=SEMANTICS SYS_INCLUDE=test INCLUDE=/usr/include USERID=test/test@$ORASID
/opt/SUNWspro/prod/bin/CC Testmain.cpp -library=iostream -library=rwtools7 -o $TESTLIB/test -I$TESTSRC/test -I$PROCINCLUDE -I$CPPLIB -L$ORACLE_HOME/lib32 -lnsl -lclntsh -R/$ORACLE_HOME/lib32
Output
===============================
Testmain.cpp : main() Testing 1
Testmain.cpp : main() Testing 2
Testmain.cpp : main() Testing 3
Testmain.cpp : main() Testing 4
Testmain.cpp : main() Testing 5 0
ORA-01012: not logged on
So, anyone has any idea how to resolve this error? So that "ORA-01012"
does not show up?
|
|
|
Goto Forum:
Current Time: Thu Apr 17 08:22:27 CDT 2025
|