vs2010 + oracle11g + occi, getString 出错

kaizibaby1208 2012-09-26 11:49:06
 try{


Environment *env=Environment::createEnvironment(Environment::OBJECT);
Connection *conn = env->createConnection(username,password,constr);
cout<<"hello world..."<<endl;
Statement *stmt = conn->createStatement("Select id, name from yqys");
ResultSet *rs = NULL;
rs = stmt->executeQuery();
string abc;
while(rs->next())
{
//cout<<rs->getStream(1)<<endl;
cout<<rs->getString(2)<<endl;
cout<<rs->getString(3);
}

conn->terminateStatement(stmt);
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
}catch(SQLException excp){
std::cout <<"exception:" <<excp.what()<<endl;
}

大致的代码如上,getInt没问题,getString 就不行。
错误描述:Windows 已在 DBUtil.exe 中触发一个断点。其原因可能是堆被损坏,这说明 DBUtil.exe 中或它所加载的任何 DLL 中有 Bug。原因也可能是用户在 DBUtil.exe 具有焦点时按下了 F12。
网上所有能用的方法都用了,都解决不了问题。
请大家帮帮忙啊。
大家可以参考两个帖子
1.http://www.google.com.hk/url?sa=t&rct=j&q=occi+getstring&source=web&cd=5&ved=0CEgQFjAE&url=https%3A%2F%2Fforums.oracle.com%2Fforums%2Fthread.jspa%3FmessageID%3D10408381&ei=wyNjULX3EeqQiQenxoHQDA&usg=AFQjCNFq7KyMHfuIsuiMqAyv48dUcwnz5w&cad=rjt
这个帖子说是occi的版本和vs2010不符合,后来用了新的oci.dll了就行了,但是我没弄明白怎么去替换。
2.http://topic.csdn.net/u/20100806/15/9192094f-d621-4da2-93e5-976b29dce4ff.html
这个朋友和我一样问题,把所有的该配置的都配置了,都没有用
...全文
350 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
songlifen 2014-11-19
  • 打赏
  • 举报
回复
最近我也碰到, 搜索到是 需要在项目(vs2008)里设置 C/C++ -> “代码生成” -> "运行库" 为 多线程DLL(/MD)
极速蜗牛1988 2013-12-05
  • 打赏
  • 举报
回复
4楼能说清楚点吗
Exaybachay 2013-08-12
  • 打赏
  • 举报
回复
occi 是 c++ 库, 请使用正确版本的 vc 并且, 不要连接 debug 版本的 crt .
赵4老师 2013-08-12
  • 打赏
  • 举报
回复
参考demo\*.c: Program Name Features Illustrated cdemo81.c Using basic SQL processing with release 8 and later functionality. cdemo82.c Performing basic processing of user-defined objects. cdemocor.c Using complex object retrieval (COR) to improve performance. cdemodr1.c,cdemodr2.c,cdemodr3.c Using INSERT/UPDATE/DELETE statements with RETURNING clause used with basic datatypes, LOBs and REFs. cdemodsa.c Describing information about a table. cdemodsc.c Describing information about an object type. cdemofo.c Registering and operating application failover callbacks. cdemolb.c Create and insert LOB data and then read, write, copy, append and trim the data. cdemolb2.c Writing and reading of CLOB/BLOB columns with stream mode and callback functions. cdemolbs.c Writing and reading to LOBs with the LOB buffering system. cdemobj.c Pinning and navigation of REF object. cdemorid.c Using INSERT, UPDATE, DELETE statements and fetches to get multiple rowids in one round-trip. cdemoses.c Using session switching and migration. cdemothr.c Using the OCIThread package. cdemosyev.c Registering predefined subscriptions and specifying a callback function to be invoked for client notifications (for more information about Advanced Queuing, see Oracle Streams Advanced Queuing User’s Guide and Reference). ociaqdemo00.c,ociaqdemo01.c,ociaqdemo02.c Advanced queuing. cdemodp.c,cdemodp_lip.c Loading data with the direct path load functions. cdemdpco.c Loading a column object with the direct path load functions. cdemdpno.c Loading a nested column object with the direct path load functions. cdemdpin.c Loading derived type (inheritance) - direct path. cdemdpit.c Loading an object table with inheritance - direct path. cdemdpro.c Loading a reference with the direct path load functions. cdemdpss.c Loading SQL strings with the direct path load functions. cdemoucb.c,cdemoucbl.c Using static and dynamic user callbacks. cdemoupk.c,cdemoup1.c,cdemoup2.c Using dynamic user callbacks with multiple packages. cdemodt.c Datetime and interval example. cdemosc.c Scrollable cursor. cdemol2l.c Accesses LOBs using the LONG API. cdemoin1.c Inheritance demo which modifies an inherited type in a table and displays a record from the table. cdemoin2.c Inheritance demo to do attribute substitutability. cdemoin3.c Inheritance demo that describes an object, inherited types, object tables, and a sub-table. cdemoanydata1.c Anydata demo. Inserts and selects rows to and from anydata table. cdemoanydata2.c Anydata demo. Creates a type piecewise using OCITypeBeginCreate() and then describes the new type created. cdemosp.c Session pooling. cdemocp.c Connection pooling. cdemocpproxy.c Connection pooling with proxy functionality. cdemostc.c Statement caching. cdemouni.c Program for OCI UTF16 API. nchdemo1.c Shows nchar implicit conversion feature and codepoint feature.
御龙湾_骑士 2013-08-12
  • 打赏
  • 举报
回复
是不是occi支持的数据库版本和你安装的数据库版本对应不上啊,我在官网上看了只支持11。2.0和11.3.0呢
kaizibaby1208 2012-09-28
  • 打赏
  • 举报
回复
有没有朋友会的啊,帮下忙啊

64,661

社区成员

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

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