oracle - Ubuntu ORA-24960 : the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255

标签 oracle ubuntu occi

我正在尝试在 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(或者我忽略了这一点)。

如有任何帮助,我们将不胜感激。

最佳答案

通过恢复到较旧的编译器解决了问题。

$ 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 库的编译器和库不兼容。

关于oracle - Ubuntu ORA-24960 : the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42890553/

相关文章:

performance - 伪造 Oracle 统计数据?

php - CakePhp 应用程序在 EC2 Ubuntu 实例上出现 500 服务器错误

c++ - 在代码块上用 C++ 编译 Oracle 数据库环境时出错

oracle - 一次从 PL/SQL 变量中添加一个元素到集合变量中?

C# 查询命令 SQL 带引号

sql - 列出Oracle中给定用户的所有表

r - 在 Ubuntu 16.04 中安装 R 3.0.2

ubuntu - 如何在 Luci openwrt sys.exec() 函数中传递命令行参数?

c++ - OCCI C++ 应用程序的 Visual Studio 调试运行时错误

c++ - Oracle 12. occi c++ "select for update"的最长持续时间