头文件的路径设好了吗?
oracle的相关库加上去了吗?

解决方案 »

  1.   

    都加了。
    在别人的帮助下,修改了occiCommon.h occiControl.h occi.h这三个头文件,现在编译通过了,程序运行的时候还是有些问题。
      

  2.   

    什么问题??
    有没有可能是OCI函数用得不对?
      

  3.   

    就是这个函数调用displayAllRows有问题,只能显示一条记录。
    错误信息为:Debug Assertion Failed!函数displayAllRows的定义如下:
    void displayAllRows ()
    {
      string sqlStmt = "SELECT author_id, author_name FROM author_tab";
      stmt = conn->createStatement (sqlStmt);
      ResultSet *rset = stmt->executeQuery ();
      try
      {
        while (rset->next())
        {
          cout << "author_id: " << rset->getInt (1) << "  author_name: " << rset
                   ->getString (2) << endl;
        }
      }
      catch(SQLException ex)
      {
        cout<<"Exception thrown for displayAllRows"<<endl;
        cout<<"Error number: "<<  ex.getErrorCode() << endl;
        cout<<ex.getMessage() << endl;
      }
      stmt->closeResultSet (rset);
      conn->terminateStatement (stmt);
    }
    你可以自己试一下,就知道了。
      

  4.   

    你的occiCommon.h occiControl.h occi.h这三个文件怎么修改的,我现在只是include之后,编译就出错,
    d:\oracle\ora92\oci\include\occicontrol.h(1132) : error C2995: 'getVector' : template function has already been defined
            d:\oracle\ora92\oci\include\occicommon.h(425) : see declaration of 'getVector'
    d:\oracle\ora92\oci\include\occicontrol.h(1235) : error C2995: 'setVector' : template function has already been defined
            d:\oracle\ora92\oci\include\occicommon.h(525) : see declaration of 'setVector'
    d:\oracle\ora92\oci\include\occicontrol.h(1280) : error C2995: 'getVector' : template function has already been defined
            d:\oracle\ora92\oci\include\occicommon.h(474) : see declaration of 'getVector'
    d:\oracle\ora92\oci\include\occiobjects.h(640) : error C2995: 'getVector' : template function has already been defined
            d:\oracle\ora92\oci\include\occicommon.h(353) : see declaration of 'getVector'
    d:\oracle\ora92\oci\include\occiobjects.h(737) : error C2995: 'setVector' : template function has already been defined
            d:\oracle\ora92\oci\include\occicommon.h(379) : see declaration of 'setVector'
    Error executing cl.exe.XTable.exe - 5 error(s), 0 warning(s)这是怎么搞得,因为是oracle自带的东西,我不敢动,可是又不知道什么地方出错?
      

  5.   

    可以本分一分再修改
    我做的是linux下的,没有这种情况
      

  6.   

    1 occi.h,注释掉下面的语句:#ifndef OCCICOMMON_ORACLE
    #include <occiCommon.h>
    #endif2 occicommoh.h,调换一下这两条语句的顺序:#define ORASTRING
    #include <string>3 occicontrol.h,在语句
    #ifdef WIN32COMMON
    的后面加上这么一句:
    #define WIN32COMMON