Linux下g++編譯C++串連oracle(OCCI)出現的問題及解決方式

來源:互聯網
上載者:User
Linux下g++編譯C++串連oracle(OCCI)出現的問題及解決方式

原文:http://lshirley2009.javaeye.com/blog/811301 文章分類:C++編程   由於項目原因,開始學習C++,剛接觸半個多月,今天參考網上例子,寫了個簡單的C++串連ORACLE的DEMO,可是使用g++編譯時間不順利,不是報這個錯就是那個,最後參考網上的解決方式和個人理解,終於調試好了,現把編譯中出現的問題和解決方案總結出來。 

  原始碼 
  C++代碼 #include <iostream>   #include <string>   #include "occi.h"   using namespace oracle::occi;   using namespace std;      int main()   {           string usr="sys";           string pwd="orcl";           string SID="ORCL";           string date;              Environment *env=Environment::createEnvironment(Environment::OBJECT);           Connection *conn= env->createConnection(usr,pwd,SID);//all strings           if(conn)                   cout<<"success createConnection!"<<endl;           else                   cout<<"failure createConnection!"<<endl;              Statement *stmt = conn->createStatement();           string sSQL = "select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual";           stmt->setSQL(sSQL);                 ResultSet *rs = stmt->executeQuery();           if(rs->next())           {                   date = rs->getString(1);           }              cout<<"now time :"<<date<<endl;              env->terminateConnection(conn);           Environment::terminateEnvironment(env);              return 0;   }        [c++]  view plain copy print ? #include <iostream>   #include <string>   #include "occi.h"   using namespace oracle::occi;   using namespace std;      int main()   {           string usr="sys";           string pwd="orcl";           string SID="ORCL";           string date;     

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.