我正在尝试在 Ubuntu 上运行以下测试程序,以使用即时客户端 OCCI 库连接到 Oracle 数据库。
#include <iostream>
#include <occi.h>
using namespace oracle::occi;
int main() {
Environment *env = Environment::createEnvironment(Environment::DEFAULT);
Connection *conn = env->createConnection( "user", "1234" );
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
}
编译时没有错误
g++ main.cpp -L ~/instantclient_12_2 -locci -lclntsh -I ~/instantclient_12_2/sdk/include
但是当我跑步时我得到
terminate called after throwing an instance of 'oracle::occi::SQLException'
what(): ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255
Aborted
我正在运行 Ubuntu 16.04、gcc 5.4.0,并且使用即时客户端 11.2 和 12.2 得到相同的结果。
之前有人问过这个问题:https ://stackoverflow.com/questions/40022118/ora-24960-the-attribute-oci-attr-username-is-greater-than-the-maximum但答案不适用于linux(或者我错过了重点)。
任何帮助,将不胜感激。