Home » Developer & Programmer » Precompilers, OCI & OCCI » Pro C program is not printing anything (Oracle 11g, OS is Windows XP and compiled in cygwin)
Pro C program is not printing anything [message #467234] Thu, 22 July 2010 18:31 Go to next message
SasDutta
Messages: 9
Registered: July 2010
Junior Member
Hi

I have small Pro C program.

#include <stdio.h>
#include <string.h>
#include <sqlda.h>
#include <sqlcpr.h>

EXEC SQL BEGIN DECLARE SECTION;
VARCHAR uid[30];
VARCHAR pwd[30];
EXEC SQL END DECLARE SECTION;


EXEC SQL INCLUDE SQLCA.H;

int main()
{

strcpy(uid.arr,"SCOTT");
uid.len =strlen(uid.arr);
strcpy(pwd.arr,"LION");
pwd.len = strlen(pwd.arr);



EXEC SQL WHENEVER sqlerror goto errexit;

EXEC SQL CONNECT :uid IDENTIFIED BY :pwd;



printf("\nConnected to Oracle8i using Scott/Tiger\n");


EXEC SQL COMMIT WORK RELEASE;
return 1;



errexit:

printf("\nConnection failed\n");

return 1;


}

To compile this program i used following commands in cygwin


$ORACLE_HOME/bin/proc test.pc
cc -I${ORACLE_HOME}/precomp/public -c test.c
cc -o test test.o -L $ORACLE_HOME/precomp/lib -l orasql11

With above command program is compiling and linking fine. But when i am running the exe, it is not printing anything. Even if it is not printing the printf statement at the very begining of the code

Can anybody help why this is happening

Thanks
Sas

[Updated on: Thu, 22 July 2010 18:36]

Report message to a moderator

Re: Pro C program is not printing anything [message #467252 is a reply to message #467234] Fri, 23 July 2010 02:00 Go to previous message
Michel Cadot
Messages: 68043
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Which printf at the very beginning of the program? I see none!

Post the complete sequence of
1/ rm test.c test.o
2/ cat test.pc
3/ Make the prgram
4/ Execute the program

Before,
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Regards
Michel

Previous Topic: Unable to compile Pro C code with Oracle 11g in windows env
Next Topic: OCINewPassword and NLS_LANGUAGE
Goto Forum:
  


Current Time: Thu Dec 02 18:56:34 CST 2021