[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2395
  • Last Modified:

Connect and query table in DB2 using iSeries ODBC

I have a code in C++ that uses
1. Connects to the target database using ODBC connection created on the system.
2. executes sql queries on the table defined in the code. e.g. Select first_name, last_name from tblNames

Everything works fine with other ODBC's i.e. SQL server / oracle / msaccess ,etc. But for DB2 i am not able to reach the correct database / table.

I need help configuring correct odbc. Following are the details:

Driver(s) available: 1. Client Access ODBC Driver (32bit) - IBM Corporation
               2. IBM DB2 ODBC Driver - International Buisness Machines Corporation
               3. iSeries Access ODBC Driver - IBM Corporation

The information available from client is:
Table name
iSeries Name
ip Address

I configured a connection using drivers 1 & 3 above and was able to connect with the information available. However when i use SQLcon32 utility to get list of tables, i see the tables from QGPL and nothing from the Database/library that i am interested in. Also i tried to run sql query "Select * from libraryname.tblname" but the driver complains "[IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0204 - [Table name] in [DB] type *FILE not found.

Any ideas?
1 Solution
Dave FordSoftware Developer / Database AdministratorCommented:
You might try "libraryname/tblname" instead of "libraryname.tblname". If your ODBC data-source is configured with a naming convention of *SYS (instead of *SQL), then it'll look for slash instead of period.


Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now