简体   繁体   中英

Connecting to DB2 from USS on z/OS mainframe

I am writing a C program in Unix System Services on az/OS mainframe. One of the requirements is to get a sequence number from a DB2 database residing on the same mainframe. Not having DB2 Connect available, I'm wondering what my options might be. I can open a socket on port 50000 (the default DB2 port), but, from the IBM documentation I can locate, I am unclear about the rest of the process in this environment.

I have UNIX and DB2 in my background, but I'm just getting my feet wet in the z/OS world, so I'm trying to keep this as straightforward and maintainable as possible.

为什么不使用unix ODBC驱动程序连接数据库并使用ODBC的sql方言......这很容易做到......以这种方式使用ODBC,灵活性是为了将来的可维护性,比如切换到不同的数据库提供者...请参阅此处获取通过ODBC进行交互的示例C代码

There is a specific section for ODBC access to DB2/z in the DB2/z 9.1 docs over on publib . Publib should always be the first point of call for any IBM doco.

There's also the DB2/z ODBC PDF .

This is the best way to access DB2/z from C on OE/OMVS/USS (or whatever it's called nowadays). If it was Java, I could probably help out more. The online help was invaluable in getting JREs to talk to the mainframe DB2 (from both USS and PCs) with minimal hassling of our local sysprogs. Of course, it'll be a lot easier with them :-) especially for setting up the z/OS (non-USS) side of things.

For C++ I can recommend OTL template library to simplify ODBC interaction. It works with IBM C++ and DB2 for z/OS. Can be used on different platforms.

Link: Oracle, ODBC and DB2-CLI Template Library

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM