大家好,刚发了个帖子,发现有点错误,不好意思
我遇到的这个问题就是在注释那一行,如果用getInt(1)的话,运行后会出现这样的情况:(能全部查的出来,但是后面会有那个表不存在的错误,晕)
-------------
id: 2
-------------
id: 1
-------------
id: 3
-------------
id: 4
-------------
id: 2
Error running the demo: ORA-00942: table or view does not exist如果用getString(2)的话,程序运行一半查出两行后就会报错:
-------------
summary: abcdefg
-------------
summary: bbbbb
*** glibc detected *** double free or corruption (out): 0x0000000000591050 ***
Aborted
 
请问哪位大虾能帮帮我,怎么解决这两个问题?急哦!!!!!!!!!!!!!局部代码如下:
 void displayAllRows ()
  {
    cout << "Displaying all the rows of the table" << endl;
    stmt = conn->createStatement (
      "SELECT id,summary FROM book");    journal c2;    ResultSet *rs = stmt->executeQuery();
    try{
    while (rs->next())
    {
      cout <<"-------------"<<endl;
      cout << "id: " << rs->getInt(1) << endl;
//      cout << "summary: "<< rs->getString(2)<<endl;;
    }
   }catch(SQLException ex)
    {
     cout<<"Exception thrown for displayRow"<<endl;
     cout<<"Error number: "<<  ex.getErrorCode() << endl;
     cout<<ex.getMessage() << endl;
    }
    stmt->closeResultSet (rs);
    conn->terminateStatement (stmt);  }

解决方案 »

  1.   

    c++代码?sql很简单了
    getInt(1)    就是  getInt("id")
    getString(2) 就是  getString("summary")
    2种写法是一样的。能出结果就不该有错的。你把sql换张表再试下,看是否同样错误,可能程序有错
      

  2.   

    程序错误?应该不会吧?我是在oracle10g下的例子啊是oracle自带的例子哦
      

  3.   

    哥们,我也是getstring 出错,getInt是好的,你的问题解决了吗?能帮我一下吗?
      

  4.   

    OCCI就是块鸡肋。10g里头应该修复了不少bug吧。
    看代码,似乎没什么问题,倒像是你的环境出了问题。看看是不是glibc与Oracle OCCI要求的版本不一致。