Re: Q: How to check if database is up using Pro*C
Date: 1996/11/11
Message-ID: <56778g$m5e_at_newton.pacific.net.sg>#1/1
gsa_at_li.net (Gary Assa) wrote:
>I am writing a Pro*C program that executes from a web page that has many
>user enterable fields. However if the database is down (due to backups
>or some other reason) I don't want to make the people spend time entering
>all these fields then have "ORACLE ERROR, etc" pop up. How can I quickly
>check that the database is up before jumping to the web page??
>
>I need the C code, not an idea.
>
>--
>=========================================================
> http://www.li.net/~gsa/index.html
>This is my signature file, not part of this mail message.
Try the following code
#include <stdio.h>
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR uid[10];
VARCHAR pwd[10];
EXEC SQL END DECLARE SECTION;
main()
{
strcpy(uid.arr,"scott");
strcpy(pwd.arr,"tiger");
uid.len = strlen(uid.arr);
pwd.len = strlen(pwd.arr);
EXEC SQL CONNECT :uid IDENTIFIED BY :pwd;
if (sqlca.sqlcode < 0)
{
printf("\nUnable to connect to database....");
exit(1);
}
}
Hope the above code is useful to you
Regards
N.Prabhakar
Socgen Crosby Securities
Singapore
Received on Mon Nov 11 1996 - 00:00:00 CET
