Home » Developer & Programmer » Precompilers, OCI & OCCI » database connection
database connection [message #93672] Fri, 04 October 2002 01:24 Go to next message
Messages: 36
Registered: December 2000
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
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
Messages: 19
Registered: July 2002
Junior Member
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"); }
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