Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2007
    Posts
    5

    Unanswered: 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 13:39.

  2. #2
    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

  3. #3
    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

  4. #4
    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

  5. #5
    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

  6. #6
    Join Date
    Jan 2003
    Posts
    1,605
    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.

  7. #7
    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....

  8. #8
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  9. #9
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •