Home » Developer & Programmer » Precompilers, OCI & OCCI » database connection
database connection [message #93672] Fri, 04 October 2002 01:24 Go to next message
meena
Messages: 36
Registered: December 2000
Member
How do know if the database connection is available or not.
In one program, I use EXEC SQL CONNECT statement to connect to the database. In the other program, I would like to know if the connection is already established if not give the connect statement again. But How do find if the connection is established or not.

Urgent !! Please Help!!!!
Re: database connection [message #93694 is a reply to message #93672] Wed, 16 October 2002 22:26 Go to previous messageGo to next message
war5ter
Messages: 4
Registered: October 2002
Junior Member
I use the EXEC SQL CONNECT in all my pro*C programs individually. Believe that in java, you can create a connection object and use an instance of the same object by different processes to connect to oracle.
Re: database connection [message #93707 is a reply to message #93672] Fri, 25 October 2002 01:24 Go to previous message
Gnanam
Messages: 19
Registered: July 2002
Junior Member
Hi,
In all Pro*C u should connect Oracle by
EXEC SQL CONNECT :user_id IDENTIFIED BY :passwd AT dbs USING :dbname;

if u want to check the connect is ok after the above command executed u use the following ...

if(sqlca.sqlcode==0) { printf("connection OK"); }
or
if sqlca.sqlcode!=0 then the connect is failed.

hope this will help u.
Previous Topic: pro*c pre-beginner
Next Topic: Could not create a connection with OCCI
Goto Forum:
  


Current Time: Mon May 27 10:04:52 CDT 2024