| Error ORA-01012: not logged on [message #144453]
||Wed, 26 October 2005 08:49
Registered: October 2005
Location: Torino, Italy
I'm new on this forum, and my english is not very fine, so I make
excuses myself before...
I must write a program with OCI libs, and I followed manuals and
examples found on OTN to reach a sufficient skill to write my own
First I wrote a test program in a single main() function, and all works
Now I'm trying to split my main() in several functions (like db_init(),
db_connect(), db_query(), db_close()), but here I've a problem!
The program which is calling that functions is like the following one
(I simplified the calls, bat the substance is the same. The functions
are defined in another source code)
db = db_init();
Here short descriptions of the functions:
In db_init I call OCIEnvCreate() and OCIHandleAlloc() for an error
handle. All handles are persistent and stored in the struct pointed by
*db: the type db_struct is defined in the header file db.h, and
contains all pointers to the OCI handles used by the program (OCIEnv,
db_connect() calls all functions needed for a user authenticated
connection to db: several OCIHandleAlloc() and OCIAttrSet() for server
and service context handles, OCIServerAttach() and finally
OCISessionBegin(). The sequence of calls is the same of my prevoious
test main(), where all worked fine.
db_query() allocates and prepares properly the statement handle, and
here I have the error in subject (ORA-01012: not logged on): it happens
when I try the OCIStmtExecute(). It seems that the user session on db
is lost between the calls to the funtions db_connect() and db_query().
It sound very strange to me: the parameters are passed correcltly,
otherwise also the passage from db_init() to db_connect() shouldn't
I repeat that the same calls and parameters passage works in the first
single-main() test program (the only difference is in the presence of
db_struct: in test main() I had separate pointers variables)!!!
I checked all the calls and they seem correct to me, I can't see where
my errors are, if there are!
Please, help me if you can !
Thank you, GePs