Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Failed to use Pro *C to write CGI program ?
Here's my 2 cents...
First, put some diagnostics in the code that write to a file so you have the program tell you what's failing when its runs under the cgi shell.
Second, many times when you run cgi stuff through the web server the path environment isnt the same as when you run things at the normal command line. I would also, put in some diag code to capture the path environment to a file so you can review.
allen
Eric Chow wrote:
>
> Hello,
>
> I tried to use Pro *C to write a simple CGI program, but it failed when
> I executed in browsers.
> The following is the source code :
> -------------------------
> #include <stdio.h>
> EXEC SQL INCLUDE SQLCA;
> int main() {
> char db[] = "user/pass_at_db";
> int result;
>
> EXEC SQL CONNECT :db;
>
> EXEC SQL SELECT count(*) INTO result FROM testDB;
> /* output to the WEB */
> printf("Content-type: text/html\n");
> printf("<html><body>Result = %d</body></html>\n", result);
> return 1;
> }
> ----------------------------
> The above program can compile successfully and can be executed very well
> in command prompt in Sun Solaris 2.6.
> After I put the executable file in cgi-bin, and load in in browser.
> It can't display anything justpop out a window with "This document
> contains no data....". And then I remove all the embed SQL just leaving
> the standard C statements, it can be loaded well in browser.
>
> Would you please to teach me how can I use C(Pro *C) to write CGI
> program ??
> Or is there any other method to connect to Oracle in C ?????
>
> Best regards,
> Eric
--
Hayden Worthington, Inc. Oracle Consulting Services 5696 Peachtree Parkway http://hayden.home.mindspring.com Atlanta, Georgia 30092 White Papers, Scripts, etc.Received on Fri Oct 15 1999 - 08:46:27 CDT