If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SQLAllocHandle gives error...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-14-07, 12:35
Sanjay Sutar Sanjay Sutar is offline
Registered User
 
Join Date: Jun 2007
Posts: 5
SQLAllocHandle gives error...

Hi All,

I have written some code to connect to db2 and it works fine on Windows but the same code gives error on Aix.

The call to SQLAllocHandle fails with return code -1.

Here is the call,

if((retCode=SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &m_hEnv))
!=SQL_SUCCESS)

I can connect to the database on the said Aix box and it seems to work fine.

Here are the db2 and Aix details

bash-2.05b$ db2level
DB21085I Instance "db2inst2" uses "64" bits and DB2 code release "SQL08012"
with level identifier "02030106".
Informational tokens are "DB2 v8.1.1.16", "s030508", "U486566", and FixPak "2".
Product is installed at "/usr/opt/db2_08_01".

bash-2.05b$ db2licm -l
Product Name = "DB2 Enterprise Server Edition"
Product Password = "DB2ESE"
Version Information = "8.1"
Expiry Date = "Permanent"
Registered Connect User Policy = "Disabled"
Enforcement Policy = "Soft Stop"
Number of processors = "1"
Number of licensed processors = "1"
Annotation = ""
Other information = ""

bash-2.05b$ uname -a
AIX tivaix5 3 5 00C00F8F4C00


I am new to db2 and not sure how I will start to trouble shoot the problem
Any help is greatly appreciated.

Thanks in advance,
Sanjay

Last edited by Sanjay Sutar; 06-14-07 at 12:39.
Reply With Quote
  #2 (permalink)  
Old 06-15-07, 11:54
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
Are you sure that the odbc has been setup on aix. this is totally different from windows platform?
see some links :

http://www.ibm.com/developerworks/ai...-unixODBC.html
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #3 (permalink)  
Old 06-15-07, 12:50
Sanjay Sutar Sanjay Sutar is offline
Registered User
 
Join Date: Jun 2007
Posts: 5
Thanks for your reply!!
will try that!

But I am able to connect to my database (testdb) as ;

bash-2.05b$ db2 connect to testdb user db2inst2
Enter current password for db2inst2:

Database Connection Information

Database server = DB2/AIX64 8.1.0
SQL authorization ID = DB2INST2
Local database alias = TESTDB
Reply With Quote
  #4 (permalink)  
Old 06-16-07, 04:34
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
this is a db2 connect and not using odbc - the protocol is different
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #5 (permalink)  
Old 06-26-07, 02:57
Sanjay Sutar Sanjay Sutar is offline
Registered User
 
Join Date: Jun 2007
Posts: 5
well my team mate , who has done such dev told that he never need any unixODBC drivers to run his application.

He/(even I) just building the application with libdb2.a and also linking to it while running ( my application doesnt run until I show it the liddb2.a through LIBPATH)

I tried diff libdb2.a files but to no avail.

But my team mate swears that he never did anything more than this.


Please help....
Dont hesitate to ask for more information...


Thanks,
Sanjay
Reply With Quote
  #6 (permalink)  
Old 06-26-07, 03:10
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Quote:
Originally Posted by Sanjay Sutar
The call to SQLAllocHandle fails with return code -1.
... and what does error code says? Any details would help.
Reply With Quote
  #7 (permalink)  
Old 06-26-07, 04:40
Sanjay Sutar Sanjay Sutar is offline
Registered User
 
Join Date: Jun 2007
Posts: 5
I do call SQLGetDiagField when SQLAllocHandle fails but even it returns SQL_ERROR and NULL in errror text.....

So it seems that none of the API are working....
Reply With Quote
  #8 (permalink)  
Old 06-29-07, 03:09
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Have you tried to turn on a CLI trace and see what the trace record says?

Also, using CLI (aka ODBC) on AIX is very simple. You just have to link your application with "libdb2.a", i.e. use the linker option -ldb2.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #9 (permalink)  
Old 06-29-07, 03:24
Sanjay Sutar Sanjay Sutar is offline
Registered User
 
Join Date: Jun 2007
Posts: 5
I have an update!!

I just formated my Aix box and re-installed db2 and it worked fine...

I will never know what was the real issue.

Thanks all for your help....


Cheers,
Sanjay
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On