OTL连接oracle的简单问题

nizainade 2007-07-18 05:07:25
写了用otl连接oracle的简单的测试代码:
#include <iostream>
#include <string>
#include "otlv4.h"
//#include "oci.h"
#define OTL_ORA9I
//#define OTL_ORA_TIMESTAMP


void main()
{
otl_conn conct();
std::string strLink("kjwg/kjwg@kjwg");
try
{
conct.rlogon(strLink);
}
catch (...)
{
std::cout<<"连接失败!";
return;
}
std::cout<<"连接成功!"
conct.logoff();
}
编译出的错误有:

2.cpp
E:\项目\2\2.cpp(11) : error C2065: 'otl_conn' : undeclared identifier
E:\项目\2\2.cpp(11) : error C2146: syntax error : missing ';' before identifier 'conct'
E:\项目\2\2.cpp(11) : error C2065: 'conct' : undeclared identifier
E:\项目\2\2.cpp(15) : error C2228: left of '.rlogon' must have class/struct/union type
E:\项目\2\2.cpp(23) : error C2146: syntax error : missing ';' before identifier 'conct'
E:\项目\2\2.cpp(23) : error C2228: left of '.logoff' must have class/struct/union type
Error executing cl.exe.

貌似是因为'otl_conn' 没有定义,但是我已经把otlv4.h包含进来了,这是怎么回事?
...全文
245 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
nizainade 2007-07-19
  • 打赏
  • 举报
回复
我只是感觉otl连接数据库比较方便,我是看到别人这么用的所以测试一下多谢楼上的帮助
Oversense 2007-07-18
  • 打赏
  • 举报
回复
otlv4.h 可以兼容多个平台,sql server, access, oracle 等

不过你怎么想到用otl呢?
nizainade 2007-07-18
  • 打赏
  • 举报
回复
多谢Oversense(步步文),呵呵问题解决了,不过原因是什么呢,是otlv4.h文件里面要有 #define OTL_ORA9I 这个定义吗
Oversense 2007-07-18
  • 打赏
  • 举报
回复
#include "otlv4.h"
#define OTL_ORA9I

改为


#define OTL_ORA9I
#include "otlv4.h"

64,639

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧