DB2 API

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
srikanthd1978
Charter Member
Charter Member
Posts: 38
Joined: Wed Mar 17, 2004 1:16 am
Location: USA

DB2 API

Post by srikanthd1978 »

guys,

has anyone come across the following error.. I am using a User defined query in my DB2 API to pull data and throw it to a Dataset..

Fatal: SQLAllocHandle: Failed to allocate environment handle 'ENV'.

all inputs are welcome..

thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

SQLAllocHandle is a call to a function in the ODBC API, one of SQLAllocEnv, SQLAllocConnect or SQLAllocStmt. The DB2 API largely follows the conventions and protocols of the ODBC API.

Without any other information it's really difficult to diagnose further. However, you may find the following information useful.

SQLAllocEnv simply grabs some memory in which to manage the connection environment(s), primarily error handling. It should only ever fail if the system can not deliver any virtual memory, which ought to be fairly rare.

SQLAllocConnect grabs some more memory, in which to manage an individual connection environment, including structures for interaction with the database and discovery of information about the driver and the database.

SQLAllocStmt requests memory in which the preparation and execution of SQL statements and retrieval of result sets is managed, including binding of variables to query parameters and result set columns.

If you have any DB2 trace tools, use them to try to figure out at which point the process is failing.

You might also like to contact your DB2 support provider; they may have some extra diagnostic tools available.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Eric
Participant
Posts: 254
Joined: Mon Sep 29, 2003 4:35 am

Post by Eric »

Are you trying to use the special environment variable $ENV ?
srikanthd1978
Charter Member
Charter Member
Posts: 38
Joined: Wed Mar 17, 2004 1:16 am
Location: USA

Post by srikanthd1978 »

hi eric,

I am not trying to use any special env varaibles.. the API was previously working fine..but now it does not seem to work.. as ray had said do u think its a problem with the Virtual Memory allocation..

..all inputs are welcome..

thanks
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

Within the context of ODBC connections the SQLAllocHandle is used to allocate handles for environments, connections, statements, and descriptors. Giving that this did work previously then the most likely culprit would be the inability to allocate a handle for a specific environment because some sort of limit has been reached.
In ODBC, no limit is defined on the number of environment, connection, statement, or descriptor handles that can be allocated at any one time. Drivers may impose a limit on the number of a certain type of handle that can be allocated at a time
It might be worth checking to see if you are running up against some sort of limit, otherwise I'm not sure why this would happen.

I found the following on a DB2 information tech site -
The limit for the number of handles that can be allocated for the type of handle indicated by the HandleType argument has been reached, or in some cases, insufficient system resources exist to properly initialize the new handle
This is likely what is happening.
manishk
Participant
Posts: 32
Joined: Tue Oct 25, 2005 8:45 pm

SQLAllocHandle: Failed to allocate environment handle 'ENV'

Post by manishk »

Hi

I am running the PX jobs . I am currently using DB2 API.

Here is the error which i am getting.



FIRST ERROR :" stgDB2ReadScotiaGlobe,0: Failure during execution of operator logic."

SUBSEQUENT ERROR : "stgDB2ReadScotiaGlobe,0: Fatal Error: Fatal: SQLAllocHandle: Failed to allocate environment handle 'ENV'. "



Please let me know what all parameters in the environment are required to over come this.

Please suggest in this regards.

Thanks
Manish
Thanks
Manish
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Most likely more physical memory, or more virtual memory, or higher ulimit setting for the executing user.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

Is there a reason why you are not using the DB2 Enterprise stage for reading/writing data? It is more efficient and better supported than the API stage.

Brad.
Post Reply