免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1840 | 回复: 1
打印 上一主题 下一主题

AIX下DB2预编译嵌入sql的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-06-24 11:32 |只看该作者 |倒序浏览
//Sales.sqC
#include <iostream.h>;
#include <string.h>;
#include "usr/opt/db2_08_01/include/sqlenv.h"
#include "usr/opt/db2_08_01/include/sql.h"
#include "usr/opt/db2_08_01/include/sqlca.h"
#include "usr/opt/db2_08_01/include/sqlda.h"
#include "usr/opt/db2_08_01/include/sqlutil.h"
#include "usr/opt/db2_08_01/include/sqladef.h"

void PrintStr()
{
        int i;
        for (i=0;i<10;i++)          
           cout<<"Hello World!\n";
}


void getDB2data()
{       
        EXEC SQL BEGIN DECLARE SECTION;
                 char userid[9]="db2inst1";
                 char psw[2]="1";
                 char DBName[7]="sample";
                 sqlint16  iSales;
                 char sRegion[16];
               
        EXEC SQL END DECLARE SECTION;                                
        EXEC SQL INCLUDE SQLCA;  
                        
        cout<<"rint DB Info..."<<endl;
        EXEC SQL CONNECT TO BName USER :userid USING :psw;
        cout<<"Connected DB\n";
        EXEC SQL SELECT REGION,SALES INTO :sRegion,:iSales FROM SALES WHERE SALES=18;
        //EXEC SQL COMMIT;
               
        cout<<"Region="<<sRegion<<"     Sales="<<iSales<<endl;
        char cRegion[16];
        strcpy(cRegion,sRegion);
        cout<<"cRegion="<<cRegion<<endl;
        cout<<"rint DB Info complete\n";

        EXEC SQL CONNECT RESET;
        //free( inout_sqlda );

}


int main()
{
        char ch[1];
        PrintStr();
        getDB2data();
        cout<<"\nPress any key to exit.\n";
        cin>;>;ch;
        return 0;
       
}

--------------------------------------------------------------------------
上面代码在prep时:
db2 =>;prep /home/qlw/Sales/Sales.sqC bindfile
报错说不能生成bnd文件,怎么办?

论坛徽章:
0
2 [报告]
发表于 2004-06-24 17:27 |只看该作者

AIX下DB2预编译嵌入sql的问题

LINE MESSAGES FOR Sales.sqC
------ --------------------------------------------------------------------
SQL0060W The "C++" precompiler is in progress.
SQL0031C File "/home/qlw/Sales/Sales.bnd" could not be
opened.
SQL0095N No bind file was created because of previous
errors.
SQL0091W Precompilation or binding was ended with "2"
errors and "0" warnings.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP