Sybase CTISQL Utility/12.5.1/P-EBF12627 ESD #9/DRV.12.5.1.4/RS6000/AIX 4.3.3/BUI LD1251-042/OPT/Thu Jun 23 18:49:34 2005 Confidential property of Sybase, Inc. Copyright 1987, 2005 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. This software contains confidential and trade secret information of Sybase, Inc. Use, duplication or disclosure of the software and documentation by the U.S. Government is subject to restrictions set forth in a license agreement between the Government and Sybase, Inc. or other written agreement specifying the Government's rights to use the software and any applicable FAR provisions, for example, FAR 52.227-19. Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
isql -U -P -S 可以登陆数据库 程序: #include "head.h" EXEC SQL INCLUDE sqlca; unsigned long lRespCode; char*pCommArea; EXEC SQL BEGIN DECLARE SECTION; char WK_NAM[31]; char DB_USER[9]; char DB_PASS[9]; char DB_SERVER[9]; EXEC SQL END DECLARE SECTION;
int main() { char msgdata[256] = "start ......"; printf("ARMS ARMO0001 START ...... \n"); EXEC CICS ADDRESS EIB(dfheiptr) RESP(lRespCode); if(lRespCode != DFHRESP(NORMAL)) { fprintf(stderr,"Error occured addressing eib,rc=%ld\n", \ lRespCode); EXEC CICS ABEND ABCODE("A001"); EXEC CICS RETURN; } EXEC CICS ADDRESS COMMAREA(pCommArea) RESP(lRespCode); if(lRespCode != DFHRESP(NORMAL)) { fprintf(stderr,"Error occured addressing CommArea,rc=%d\n",\ lRespCode); EXEC CICS ABEND ABCODE("A002"); EXEC CICS RETURN; } EXEC CICS WRITEQ TS QUEUE ("ARMO0001") FROM (msgdata) LENGTH(sizeof(msgdata)); fprintf(stderr,"CommArea from client is[%s]\n",pCommArea); sprintf(pCommArea,"hello from server.\n"); memset(WK_NAM,'\0',sizeof(WK_NAM)); memset(DB_USER,'\0',sizeof(DB_USER)); memset(DB_PASS,'\0',sizeof(DB_PASS)); memset(DB_SERVER,'\0',sizeof(DB_SERVER));
strcpy(DB_USER,"aaaa"); strcpy(DB_PASS,"aaaa"); strcpy(DB_SERVER,"SYBASE"); EXEC SQL CONNECT B_USER IDENTIFIED BY B_PASS USING B_SERVER; if(sqlca.sqlcode != 0) { sprintf(pCommArea,"connect db err,rc1=[%ld],msg=[%s]\n", sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc); EXEC CICS RETURN; } EXEC SQL SELECT NAME INTO :WK_NAM FROM MYTEST WHERE TITID = 'bbb'; if(sqlca.sqlcode != 0 { sprintf(pCommArea,"select db err,rc=[%d],msg=[%s]\n", sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc); EXEC CICS RETURN; } else { sprintf(pCommArea,"select db ok ,result is [%s]\n",WK_NAM); } EXEC CICS RETURN; } /* end of file */
[此贴子已经被作者于2006-3-21 14:00:19编辑过]
|