IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Connecting to DB2 ver. 8 for z/OS, using CLI (ODBC)


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aleksey

New User


Joined: 24 Apr 2007
Posts: 13
Location: Russia

PostPosted: Wed Oct 03, 2007 3:00 pm
Reply with quote

HI!
I'm writing C++ program, connecting to DB2 ver. 8 for z/OS, using CLI (ODBC)
Here the code:
Code:

int main(void)                                               
{                                                       
     SQLRETURN cliRC = SQL_SUCCESS;                             
     int rc = 0;                                               
     SQLHANDLE henv; /* environment handle */                   
     SQLHANDLE hdbc; /* connection handles */                   
     char dbAlias[]="****";                 
     char dbUser[]="****";                                 
     char psw[]="****";

                                                                               
     rc = CLIAppInit(dbAlias,                               
                     dbUser,                               
                     psw,                                   
                     &henv,                                 
                     &hdbc,                                 
(SQLPOINTER)SQL_AUTOCOMMIT_ON);
...
}
int CLIAppInit(char dbAlias[],                           
                    char user[],                               
                    char pswd[],                                   
                    SQLHANDLE *pHenv,                             
                    SQLHANDLE *pHdbc,                             
                    SQLPOINTER autocommitValue)                   
{                                                             
 
     SQLRETURN cliRC = SQL_SUCCESS;                                                                           
     SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, pHenv);
     ...
     return 0;                                                   
}   


On the step
Code:

SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, pHenv);     

" program fails, JCL returns code 12.

Can somebody help me? This step from the official CLI-sample.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Oct 03, 2007 11:12 pm
Reply with quote

Hello,

We will be better able to help if you also post the jcl and all of the diagnostic informatoin n the jes outputs.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Getting TWA in CICS program while con... CICS 14
No new posts ODBC connectivity on mainframe IMS DB/DC 2
No new posts Connecting LINUX system from Mainframe JCL & VSAM 1
No new posts Reg Accessing IMS DB Using ODBC Drivers IMS DB/DC 6
This topic is locked: you cannot edit posts or make replies. How to use z/OS-DB2-ODBC to move data... DB2 2
Search our Forums:

Back to Top