Ubuntu ORA-24960:属性OCI_ATTR_USERNAME大于最大允许长度255 [英] Ubuntu ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255

查看:880
本文介绍了Ubuntu ORA-24960:属性OCI_ATTR_USERNAME大于最大允许长度255的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Ubuntu上运行以下测试程序,以使用即时客户端OCCI库连接到oracle数据库.

I'm trying to run the following test program on Ubuntu to connect to an oracle database using the instant client OCCI library.

#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会得到相同的结果.

I'm running Ubuntu 16.04, gcc 5.4.0 and I get the same result with instant client 11.2 and 12.2.

此问题之前曾被问过: https://stackoverflow.com/questions/40022118/ora-24960-the-attribute-oci-attr-username-is-greater-than-the-maximum ,但答案不适用于linux(或我错过了要点).

This has been asked before: https://stackoverflow.com/questions/40022118/ora-24960-the-attribute-oci-attr-username-is-greater-than-the-maximum but the answer is not applicable to linux (or I'm missing the point).

任何帮助将不胜感激.

推荐答案

通过还原到较早的编译器解决了该问题.

Solved the problem by reverting to an older compiler.

$ sudo apt-get install g++-4.8
$ g++-4.8 main.cpp -L ~/instantclient_12_2 -locci -lclntsh -I ~/instantclient_12_2/sdk/include

也许最新的编译器和库与用于构建OCCI库的编译器和库不兼容.

Perhaps the latest compiler and libraries is incompatible with those used to build the OCCI libraries.

这篇关于Ubuntu ORA-24960:属性OCI_ATTR_USERNAME大于最大允许长度255的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆