Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Connecting to DB2 ver. 8 for z/OS, using CLI (ODBC)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Connecting to DB2 ver. 8 for z/OS, using CLI (ODBC)
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

Site Director


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

PostPosted: Wed Oct 03, 2007 11:12 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ODBC connectivity on mainframe HABBIE IMS DB/DC 2 Mon Aug 03, 2015 5:19 pm
No new posts Connecting LINUX system from Mainframe mallik4u JCL & VSAM 1 Mon May 18, 2015 7:32 pm
No new posts Reg Accessing IMS DB Using ODBC Drivers satish.ms10 IMS DB/DC 6 Wed Nov 26, 2014 6:59 pm
This topic is locked: you cannot edit posts or make replies. How to use z/OS-DB2-ODBC to move data... Ricardo Viegas DB2 2 Sat Dec 15, 2012 3:54 am
No new posts Error while connecting to DB2 sivasaras DB2 3 Mon Nov 26, 2012 8:50 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us