Help in pro*c for Oracle connection

hi,

am making oracle connection through pro*c using the following command

sample:

exec sql connect username identified by password.

but m getting the following errors frequently even though listener and db is running fine but some times code is working fine and not giving errors.

errors:

DbConnect: Local Log-on error : -1034
ErrMsg : ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
SVR4 Error: 2: No such file or directory

can anybody guide to what can be the actual problem.

thanks
senthil

Can you log into Oracle throgh sqlplus or other Oracle utility as the error seems to indicate that the Oracle instance you are trying to connect to isnt up or available...

You have to define the ORACLE_SID environment variable before that statement will connect. As posted it has errors that Pro*C would not allow to compile, so I'm assuming you just typed it in, rather than copy actual C code.

ORACLE_SID is the database name:

export ORACLE_SID=mydb
./my_oracle_program

If you can tnsping your db, use that same name as the SID.