Consultor Eletrônico



Kbase P31278: How to test ESQL/C-89 large client on windows to work with O
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   14/07/2003
Status: Unverified

GOAL:

How to test ESQL/C-89 large client on windows to work with Oracle data server?

GOAL:

How to build ESQL/C client to work with Oracle?

FIX:

The test assumes that sports database has been migrated to Oracle with valid login sports and password sports. Instance is running remotely on UNIX with net8 service name ts81hp.

Schema holder for sports has been created and is called sh.

1. Author source code. Here is sample source code called mytest.cc

main(argc,argv)

int argc;

char **argv;

{

/*1*/ /* Declare variables for error returns. */

long SQLCODE;

char *msg;



/* Declare variables for ESQL statements. */

EXEC SQL BEGIN DECLARE SECTION;

char nam[30];

long custnum;

EXEC SQL END DECLARE SECTION;



/*2*/ /* Declare error goto point. */

EXEC SQL WHENEVER SQLERROR GOTO err;



/*3*/ /* Log in to Progress to start an ESQL session. */

if (sqllogin( argc-1, &argv[1], "", "") == -1)

{

printf("Failed to login to Progress ESQL!\n");

while ((msg = (char *) sqlgetmsg()) != (char *) 0)

printf("%s\n",msg);

exit(2);

}



/*4*/ /* Query and display all customer names and numbers. */

EXEC SQL DECLARE x CURSOR FOR

SELECT name, cust\_num FROM customer;

EXEC SQL OPEN x;



EXEC SQL WHENEVER NOT FOUND GOTO done1;

while (1)

{

EXEC SQL FETCH x INTO :nam, :custnum;

printf("%-22s%-7ld\n",nam,custnum);

}



/*5*/ /* Log out of Progress to end the ESQL session. */

err:

printf("Error %-3ld occured.\n", SQLCODE);

while ((msg = (char *) sqlgetmsg()) != (char *) 0)

printf("%s\n",msg);



done1:

sqllogout(1);

}

2. Preprocess source code

sqlcpp mytest.cc

mytest.c is created

3. Compile source code. mytest.o is created

cl /c /I%DLC%\probuild\esqlc mytest.c

4. Create link response file with probuild

Starting probuild, select ESQL/C large client(full), link script default name is wcesql.lnk, in the next screen, select Oracle dataserver and winsock TCP/IP components, in the next screen, enter previously created object named mytest.obj Link response file is generated.

5. Link. link @wcesql.lnk
6. Test.

esqltllg -1 sh -db mei2 -dt Oracle

select statement output is displayed.