Pro*C :ORA-01012: not logged on
Date: 1998/03/12
Message-ID: <NHYN.104$yg1.424745_at_ptah.visi.com>#1/1
Hi, every one:
[Quoted] I am working on a project with pro*C/C++ v8.0.4.000. I integrated pro*C/C++
with Visual C++ 5.0. Every thing looks fine. I just pick a sample from
Oracle, sample6.pc and compiled it. Perfect! No error. I ran it, it
connected to Oracle server.ok. but when it executed first SQL command, I
got an error:ORA-01012: not logged on. It doesn't any sense to me.
On my machine, I have a lot of oracle tools which can work without any
problem!
Can any expert help me?
Thanks.
Here is the piece of the source code:
char *username = "linxtest";
char *password = "linxtest";
char *dbstring = "linx";
EXEC SQL WHENEVER SQLERROR DO sql_error();
//Connect to database
EXEC SQL DECLARE DB_NAME DATABASE;
/*I jus link to our database*/
EXEC SQL CONNECT :username IDENTIFIED BY :password
AT DB_NAME USING :dbstring;
printf( "Connected to Oracle as: %s\n", username);
/* Execute a string literal to create the table. This
- usage is actually not dynamic because the program does
- not determine the SQL statement at run time. */ puts("CREATE TABLE dyn1 (col1 VARCHAR2(4))"); /* Here I got "ORA-01012: not logged on" */ EXEC SQL EXECUTE IMMEDIATE "CREATE TABLE dyn1 (col1 VARCHAR2(4))";
/* Execute a string to insert a row. The string must
- be null-terminated. This usage is dynamic because the
- SQL statement is a string variable whose contents the
- program can determine at run time. */ strcpy((char *)dynstmt1, "INSERT INTO DYN1 values ('TEST')"); puts(dynstmt1); EXEC SQL EXECUTE IMMEDIATE :dynstmt1; ..... .....
