为什么我的社交Oracle客户端无法连接到我的Oracle服务器?

时间:2018-11-20 15:38:03

标签: oracle soci

这是我的main.cpp:

#include <soci/soci.h>
#include<soci/oracle/soci-oracle.h>
#include<iostream>
#include<istream>
#include<ostream>
#include<string>
#include<exception>
#include<unistd.h>

using namespace std;
using namespace soci;


int main() {
    session sql(oracle,"service=ORCL host=10.108.208.175 port=1521 user=IOVUSER password=iov123");
    cout << "has connected!!"<<endl;
    string sql_str = "select * from cf1";

    sql << sql_str;

}

这是我的makefile:

all: main.cpp
    g++ -std=c++11 -Wall -g -o main main.cpp -I/opt/oracle/product/11.2.0/dbhome_1/rdbms/public/  -L/usr/local/lib64/ -lsoci_core -lsoci_oracle -ldl
clean:

当我运行主服务器时,它显示无法连接服务器,我的配置正确。为什么?结果是:

./main 
terminate called after throwing an instance of 'soci::oracle_soci_error'
  what():  ORA-12154: TNS:could not resolve the connect identifier specified

[1]    16160 abort (core dumped)  ./main

0 个答案:

没有答案