[转帖]遇到和别人的帖子相同的问题,Tuxedo连接Oracle的问题_MQ, Tuxedo及OLTP讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MQ, Tuxedo及OLTP讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3037 | 回复: 0   主题: [转帖]遇到和别人的帖子相同的问题,Tuxedo连接Oracle的问题        下一篇 
solo9867
注册用户
等级:新兵
经验:61
发帖:71
精华:0
注册:2011-12-15
状态:离线
发送短消息息给solo9867 加好友    发送短消息息给solo9867 发消息
发表于: IP:您无权察看 2014-11-5 9:41:32 | [全部帖] [楼主帖] 楼主

原贴描述:
===========================================
客户程序如下:我oracle10只有一个数据库是orcl

 oracleclient.c
#include <stdio.h>
#include <atmi.h>
#include <string.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
      char *sendbuf,*recvbuf;
      long sendlen,recvlen;
      int ret;
      if(argc!=2){
            printf("please call the format as : oracleclient %s \n",argv[0]);
            (void) fprintf(stderr, "Usage: oracleclient string\n");
            exit(1);
      }
      if(tpinit((TPINIT *)NULL)==-1){
            (void)fprintf(stderr,"failed to init!\n");
            exit(1);
      }
      sendlen=strlen(argv[1]);
      if((sendbuf=(char *)tpalloc("STRING",NULL,sendlen+1))==-1){
            (void)fprintf(stderr,"failed to allocate memory to sendbuf!\n");
            tpterm();
            exit(1);
      }
      if((recvbuf=(char *)tpalloc("STRING",NULL,5*sendlen+1))==-1){
            (void)fprintf(stderr,"failed to allocate memory for recvbuf!\n");
            tpterm();
            exit(1);
      }
      strcpy(sendbuf,argv[1]);
      ret = tpcall("ORACLES", (char *)sendbuf, 0, (char **)&recvbuf, &recvlen, (long)0);
      if(ret==-1){
            (void) fprintf(stderr, "Can't send request to service oracleserver\n");
            (void) fprintf(stderr, "Tperrno = %d, %s\n, ", tperrno, tpstrerror(tperrno));
            tpfree(sendbuf);
            tpfree(recvbuf);
            tpterm();
            exit(1);
      }
      (void)fprintf(stdout,"the return result is :%s \n",recvbuf);
      tpfree(sendbuf);
      tpfree(recvbuf);
      tpterm();
      return 0;
}


服务器server程序如下:

oracleserv.pc
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atmi.h>
#include <userlog.h>
exec sql include sqlca;
tpsvrinit(int argc,char *argv[])
{
      if(tpopen()==-1){
            printf("error to connect to oracle!\n");
      }
      printf("the oracleserv successfully to connect to db2 in linux!\n");
      return 0;
}
ORACLES(TPSVCINFO *rqst)
{
      exec sql begin declare section;
      char db_string[50];
      exec sql end declare section;
      int i=0;
      for(i=0;i<rqst->len-1;i++){
            db_string=rqst->data;
      }
      exec sql delete from system.hmptest where username=:db_string;
      if(sqlca.sqlcode!=0){
            printf("delete error!\n");
            tpreturn(TPFAIL,0,NULL,0,0);
      }
      tpreturn(TPSUCCESS,0,rqst->data,0L,0);
}
tpsvrdone()
{
if(tpclose()==-1){
      printf("oracleserv close error!\n");
      return;
}
printf("oracleserv disconnected!\n");
return;
}


编译完全通过:

proc oracleserv.c parse=full include=/home/oracle/oracle/product/10.2.0/db_1/precomp/public include=/home/tuxedo/bea/tuxedo9.1/include
buildserver -o oracleserv -f "oracleserv.c -I/home/oracle/oracle/product/10.2.0/db_1/precomp/public" -r Oracle_XA -s ORACLES


没有错误。。正常运行

buildclient -o oracleclient -f oracleclient.c


但是那个exec sql delete from system.hmptest where username=:db_string;,..为什么不能执行
 我的RM文件里用户密码是system/oracle

在sqlplus 里system/oracle能完全操作hmptest数据表。。。

===========================================

--转自

北京联动北方科技有限公司



赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论