[unixODBC-support] Connecing to Oracle Express
Ken Resander
kresander at yahoo.com
Fri May 8 10:00:39 BST 2009
Thanks, that made a change.
I added the lib path /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib to LD_LIBRARY_PATH. The error message changed when I ran my testprogram ls from the command line:
ken at ken-desktop:~/projects/ls/bin/Debug$ ./ls
Usage error: SQLConnect: dsn=oracledsn, user=dba, password=abcd
1: st=IM004, nerr=0, msg=
[unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
2: st=00000, nerr=0, msg=
[unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
Press Return/Enter to continue
Exit(0)
The program fails on the SQLConnect:
char msg [ 100 ] ;
rc = SQLConnect ( hdbc , (SQLCHAR*)datasourcename , SQL_NTS,
(SQLCHAR*) userid , SQL_NTS,
(SQLCHAR*) password , SQL_NTS);
if ( !success ( rc ) )
{
sprintf ( msg , "SQLConnect: dsn=%s, user=%s, password=%s" ,
datasourcename , userid , password ) ;
sqlerrinfo ( SQL_HANDLE_DBC , NULL , (int)hdbc , msg ) ;
shret->rc = rc ; // in server handle of my old sql api
SQLFreeConnect ( hdbc ) ;
SQLFreeEnv ( henv ) ;
printf ( "Exit(0)\n" ) ; // +++ for now 8 May 2009
exit ( 0 ) ; // +++ for now
return false ;
} ;
Sorry, lost indentation. How to request the text to be left as is?
The sql calls before the SQLConnect were OK, i.e. these:
rc = SQLAllocHandle ( SQL_HANDLE_ENV , SQL_NULL_HANDLE , &henv ) ;
rc = SQLSetEnvAttr ( henv, SQL_ATTR_ODBC_VERSION , *)SQL_OV_ODBC3 , 0 ) ;
rc = SQLAllocHandle ( SQL_HANDLE_DBC , henv , &hdbc ) ;
SQLSetConnectAttr ( hdbc , SQL_LOGIN_TIMEOUT , (void*)5 , 0 ) ;
The SQLAllochandle was successful, so I do not understand the error message that reports problems with SQLAllocHandle after the SQLConnect call.
The dsn=oracledsn, user=dba, password=abcd are just taken from the Windows program. The userid and password are certainly not meaningful now and I would expect authentication error of type userid and/or password invalid. I want to connect to the Oracle sample database and issue a few selects and fetchscrolls for testing ODBC, but I do not know how how to specify the dsn,user and password for this.
Ken
Nick wrote
Add the path to the LD_LIBRARY_PATH, it affects the run time resolution of lib searches;
-- Nick
New Email names for you!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20090508/b7688ff5/attachment-0001.html>
More information about the unixODBC-support
mailing list