beautypg.com

Testing the sample, Sample application code – HP Integrity NonStop H-Series User Manual

Page 54

background image

-c ThreadODBCTestAppl.c -o ThreadODBCTestAppl.o

The following is a sample compilation command for a 64–bit application:

OSS> c89 -g -Winspect -Wextensions -Ww -Woptimize=0 \
—W lp64 —Wsystype=oss -Wrefalign=8 -Wfieldalign=auto \
-Wallow_cplusplus_comments -Wcplusplus -Wversion3 \
-Wtarget=tns/e -DYOSEMITE -Wcall_shared —D_PUT_MODEL_\
-D__GNUC__ -DOSS_DRIVER -D_DEBUG -DNSK_PLATFORM \
-DTCL_MEM_DEBUG -D__TANDEM -Dset_fieldalign \
-D_TNS_R_TARGET -WIEEE_float -I/usr/include/odbc \
-c ThreadODBCTestAppl.c -o ThreadODBCTestAppl.o

NOTE:

For C programming applications, add -Wallow_cplusplus_comments flag.

Use the eld linker to link the application with the driver (32–bit ZODBCDLL, 64–bit YODBCDLL).
By default, the driver is located in $SYSTEM.ZMXODBC directory.

Testing the sample

HP-UX and Linux

To run the sample test application, issue any of the following commands on the bash shell:

odbc]$ ./

odbc]$ ./ –help

Considerations:

If the library is not present in the default location (/usr/lib or /usr/lib64 in 64 Bit
Linux), ensure that the location of the driver (libmxodbc.so, libmxodbc64.so in 64
Bit Linux) is set in the environment variable LD_LIBRARY_PATH (Linux 32 or Linux 64) or
SHLIB_PATH(HP-UX). To set the LD_LIBRARY_PATH variable, enter the following command:

export LD_LIBRARY_PATH = < driver directory >

Ensure that the MXODSN file is present in the same location as that of the sample application.
If not, ensure that the default MXODSN file is present in /etc/hpodbc (Linux) or /etc/
mxodbc

(HP-UX), or set DSN_PATH to MXODSN location.

To enable tracing, set the TraceStart attribute in the MXODSN file to 1.

You must edit the MXODSN file to include your preferred DSN. Update all the mandatory fields
for the DSN.

OSS

To run the sample test application, issue any of the following commands on the OSS shell:

OSS> ./

OSS> ./ –help

Considerations:

Ensure that the ODBCDSN file is present in the same location as that of the sample
application. If not, ensure that the ODBCDSN file is present in the default location,
$SYSTEM.SYSTEM or in the DSN_PATH.

To enable tracing, set the TraceStart attribute in the ODBCDSN file to 1.

You must edit the ODBCDSN file to include your preferred DSN. Update all the mandatory fields
for the DSN.

Sample application code

/***************************************************************
*****
//
// @@@ START COPYRIGHT @@@

54

Sample ODBC application

This manual is related to the following products: