kevin0403
November 12th, 2007, 01:18 PM
using C++ connect to Oracle 10g, compile with visual C++6.0.
code:
//////////
#include <iostream>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
typedef vector<string> journal;
Environment *env;
Connection *conn;
string tableName;
string typeName;
int main (void)
{
string user = "system";
string passwd = "XXX";
string db = "Testx";
try
{
cout<<"STRAT"<<endl;
env = Environment::createEnvironment (Environment::DEFAULT);
cout<<"connected"<<endl;
env->terminateConnection (conn);
Environment::terminateEnvironment (env);
cout<<"done"<<endl;
}catch (SQLException ea)
{
cerr << "Error running the demo:" << ea.getMessage () <<endl;
}
return 0;
}
///////////
the message : Error running the demo: ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255.
I have downloaded the library on the oracle.com , and sure including all of the right directions.
code:
//////////
#include <iostream>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
typedef vector<string> journal;
Environment *env;
Connection *conn;
string tableName;
string typeName;
int main (void)
{
string user = "system";
string passwd = "XXX";
string db = "Testx";
try
{
cout<<"STRAT"<<endl;
env = Environment::createEnvironment (Environment::DEFAULT);
cout<<"connected"<<endl;
env->terminateConnection (conn);
Environment::terminateEnvironment (env);
cout<<"done"<<endl;
}catch (SQLException ea)
{
cerr << "Error running the demo:" << ea.getMessage () <<endl;
}
return 0;
}
///////////
the message : Error running the demo: ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255.
I have downloaded the library on the oracle.com , and sure including all of the right directions.