ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255 [message #194973] |
Tue, 26 September 2006 06:15 |
OraN
Messages: 1 Registered: September 2006
|
Junior Member |
|
|
I have a problem with creating a connection to a Oracle 10g Database. I installed Oracle Client 10g.
I have a C++ program an work with the Microsoft Visual C++ .NET 2005.
My problem refers to the following code:
Environment *env;
Connection *con;
Statement *stmt;
env = Environment::createEnvironment(Environment::DEFAULT);
con = env->createConnection(user, passwd, db);
ERROR DESCRIPTION:
Error number: 24960
ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255
OCIAttrGet with OCI_ATTR_USERNAME = -2
New Oracle C++ Call Interface (OCCI) libraries are available for Microsoft Visual C++ .NET 2005 ??
string user = "" so, is not too long!!!!!!
Thanks!!
[Updated on: Tue, 26 September 2006 06:25] Report message to a moderator
|
|
|
Re: ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255 [message #213869 is a reply to message #194973] |
Fri, 12 January 2007 10:28 |
jbo5112
Messages: 5 Registered: January 2007
|
Junior Member |
|
|
If you're using Visual Studio 2005 with OCCI, then you need to download a compatible version. The default libraries provided only support up to vc7.1 and you're using vc8.
You can get them here:
http://www.oracle.com/technology/tech/oci/occi/occidownloads.html
This may not fix your problem, but it won't work unless you download it and follow the instructions, which I believe just involve extracting the zipped files to $ORACLE_HOME/OCI/lib/MSVC/VC8 and adding that folder to the front of your system path.
Now if anyone has any ideas how I can get the win64 version of OCCI for Visual Studio 2005, it would be greatly appreciated. I get the same error, and I think this is the cause. I would just download vc7.1 but Microsoft doesn't offer it anymore.
Currently I can't even get the win32 version to run, since it has to run on the machine where 64-bit Oracle is installed. I would prefer my program to run in 64-bit (especially since I've spent 6 hours getting the compiler all set up for 64-bit), but I'll be happy either way.
Without this issue, we're in a major time crunch to finish our product, so re-writing to use different software to connect (OCI/ODBC) isn't much of an option. We has several things we have to finish before shipping, some of which haven't been started, and it could have to ship in only a couple of weeks. Our sales person is really good at convincing customers to buy our great products before they're produced. Any help would be appreciated.
|
|
|
Re: ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255 [message #297714 is a reply to message #213869] |
Sat, 02 February 2008 17:58 |
jbo5112
Messages: 5 Registered: January 2007
|
Junior Member |
|
|
I know the reply is too late for you, but it might save someone else some headache. Our company ran into the exact same problem at the same time, except our crunch was running out of development money. I couldn't get our 32-bit or 64-bit code to run on our new 64-bit platform. Eventually I found OTL, stayed up all night porting most of our C++ code, and everything worked.
The port was rather easy because OTL has a simple, well written interface that's confined to a single .h file and sticks fairly close to something like iostreams (although not a compatible drop in), unlike OCCI which seems constantly out of date and tries to redefine C++ semantics. Also, the resulting code was 2x-3x as fast, much faster to write/debug/maintain, and so far seems to be working with Visual C++ 2008. There also SOCI and Poco, but I've hardly even clicked on their websites.
It's now 2008. Oracle 11g and Visual Studio 2008 are out. Oracle doesn't mention 11g on their OCCI main page page or the downloads. Support for Visual C++ 7.1 (2003) and 8.0 (2005) seems to ship with the 32-bit (and I assume 64-bit but I haven't installed it) 11g SDK, but I don't see any support for Visual C++ 2008 anywhere. Oracle 10g STILL doesn't show 64-bit support for Visual C++. On the Linux side 10g (and I assume 11g) OCCI support for g++ 4.1 (probably 4.2 and 4.3 when that is out), but it Oracle still seems to treat it like a red-headed stepchild. I personally think that everyone should port all their OCCI code to something else, like OTL, that has better speed, support, and interface.
|
|
|
|
Re: ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255 [message #301617 is a reply to message #301258] |
Thu, 21 February 2008 03:13 |
jbo5112
Messages: 5 Registered: January 2007
|
Junior Member |
|
|
This program takes a buffer size as an argument and inserts a bunch of stuff, checking the size of the table after each insert command. The website for OTL also has a lot of good examples and somewhat poorly laid out, but quite informative documentation. Also, the message board for it is rather friendly with constant input from the project creator/maintainer. Click on the Table of Contents link to find them.
1) download OTL from otl.sourceforge.net
2) inside sqlplus
create table temp_table (data number(9));
3) c++ program
#define OTL_ORA10G_R2
// this next line is not necessary here,
// but it's useful for std::string and some iterators
#define OTL_STL
#include <iostream>
#include <otlv4.h>
using namespace std;
int main( int argc, char *argv[] ) {
int buffer_size;
int count = 0;
int i = 1;
otl_connect db;
otl_stream sql;
otl_stream sql_count;
cout << "Starting...\n" << flush;
if( argc > 1 && (buffer_size = atoi(argv[1]) ) ) {
cout << "Good number passed in\n" << flush;
}
else {
cout << "Usage " << argv[0] << " <number>\n" << flush;
return 0;
}
try {
db.rlogon( "username/password" );
// or db.rlogon( "username/password@tnsname" );
db << "truncate table temp_table";
cout << "Opening sql..." << flush;
sql_count.open( buffer_size,
"select count(1):#1<int> from temp_table",
db );
sql.open( buffer_size,
"insert into temp_table (data) values (:data<int>)",
db );
cout << "Done!\n" << flush;
while( count<1001 ) {
sql << i;
sql_count.rewind();
sql_count >> count;
cout << i << '\t' << count << endl;
if( i == buffer_size ) {
i = 1;
}
else {
++i;
}
}
}
catch( otl_exception e ) {
cout << "Program failed\n" << flush;
cout << e.msg << flush;
cout << e.stm_text << flush;
}
catch(...) {
cout << "Program failed\n" << flush;
}
sql.close();
db.commit();
return 0;
}
4) Compile the code and link it with oci.lib (should be $ORACLE_HOME\lib\MSVC\oci.lib) from Oracle or the Oracle SDK.
I don't remember how to link oci.lib or add the otlv4.h from the GUI and it would be more useful with more comments, but hopefully that will get you started. I attached the code in a file for your convenience. Also, the first release of Oracle 10G uses "#define OTL_ORA10G" and 11G uses "#define OTL_ORA11G" instead of the "#define OTL_ORA10G_R2".
I'm glad to see new C++ developers who aren't blindly jumping on the JAVA for everything bandwagon. For more C++ education, I've enjoyed the book C++ How to Program. Used, older editions are fairly cheap on Amazon.
-
Attachment: main.cpp
(Size: 1.66KB, Downloaded 3826 times)
|
|
|
|