PRO*C/C++ for AIX
From: andrija <ar35644_at_fer.hr>
Date: Wed, 9 Jan 2002 16:13:26 +0100
Message-ID: <a1hmnh$b4tr$1_at_as201.hinet.hr>
[Quoted] Is there any tutorial for PRO*C/C++ for AIX? I'm trying to compile one simple program i wrote, but I don't know how to compile it. Oracle's documentation is very poor (PRO*C/C++ guide says to check system specific documentation, and system specific documentation says to check PRO*C/C++ guide).
} d1;
} d2;
Date: Wed, 9 Jan 2002 16:13:26 +0100
Message-ID: <a1hmnh$b4tr$1_at_as201.hinet.hr>
[Quoted] Is there any tutorial for PRO*C/C++ for AIX? I'm trying to compile one simple program i wrote, but I don't know how to compile it. Oracle's documentation is very poor (PRO*C/C++ guide says to check system specific documentation, and system specific documentation says to check PRO*C/C++ guide).
Here is my program:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlda.h>
#include <sqlcpr.h>
struct {
VARCHAR key[11]; VARCHAR data[11];
} d1;
struct {
short key; short data;
} d2;
#include <sqlca.h>
VARCHAR user[10];
VARCHAR pass[10];
void main() {
strncpy((char *) user.arr,"SCOTT",10);
user.len = (unsigned short) strlen((char *) user.arr);
strncpy((char *) pass.arr, "TIGER", 10); pass.len = (unsigned short) strlen((char *) pass.arr);
EXEC SQL CONNECT :user IDENTIFIED BY :pass;
EXEC SQL SELECT key_item, data_item
INTO :d1 INDICATOR :d2 FROM t2;
d1.key.arr[d1.key.len]='\0';
d1.data.arr[d1.data.len]='\0';
printf("%s %s",d1.key.arr,d1.data.arr);
EXEC SQL ROLLBACK WORK RELEASE;
}
Received on Wed Jan 09 2002 - 16:13:26 CET