Hi Expert,
I have been working with Oracle database for quite some time now, and did write some small programs in C (turbo C) during my college days. I haven't worked on Pro*C before.
Could the experts please guide me to how to make my first program run in Pro*c.
Operating System: IBM AIX 5.3.0.0 (ml 4)
Database: Oracle 10g Release 2 (10.2.0.3)
Below is my "simple.pc" program:
#include <stdio.h>
#include <sqlca.h> /* SQL Communications Area */
#define UNAME_LEN 20 /* Varchar limits */
#define PWD_LEN 40
VARCHAR username[UNAME_LEN]; /* SQL vars for */
VARCHAR password[PWD_LEN]; /* username and passwd */
int main(){
strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
username.len = strlen((char *) username.arr);
strncpy((char *) password.arr, "TIGER", PWD_LEN);
password.len = strlen((char *) password.arr);
EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("Connected to the database as user: %s\n", username.arr);
return(0);
}
I did try to dig into documentation, but wasn't succesfully.
You little insight would save hours for me.
Thanks