TechTip: Retrieve Data from Non-DB2 Databases

DB2
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

A popular question these days is "How can my iSeries programs access data in non-DB2 databases such as Oracle and SQL Server?"

The simple answer is that some additional middleware is required because not all database products support the Distributed Relational Database Architecture (DRDA).

DB2 UDB for iSeries (and the whole IBM DB2 UDB family) has long supported the DRDA standard for remote data access and interoperability. Today, iSeries customers can use DRDA to access the other DB2 products running on UNIX and Intel servers, but not third-party databases. Other database vendors, such as Oracle and Sybase, have actually delivered tools based on DRDA. Unfortunately, they have chosen to support only part of the standard. They implemented the DRDA specification that enables them to access data in other databases, but they don't support the DRDA specifications that would allow DRDA-compliant databases (e.g., DB2 UDB for iSeries) to access and update their data.

So what middleware options exist to enable iSeries programs to access non-DB2 data? There are both proprietary and industry standards out there. With the proprietary solutions, the request is typically an SQL statement, but it's passed in via a proprietary API. That API is not available on other platforms and may not be available to all programming languages (C, RPG, Java, etc.). These solutions work fine as long the proprietary interface is not an issue.

There are basically two standard solutions available to iSeries customers. If using Java is not an issue, you may want to consider finding a Type 4 JDBC driver for the non-DB2 database that you're trying to access. Since OS/400 includes a JVM, these Type 4 JDBC drivers can be loaded directly onto your iSeries server. Once the Type 4 JDBC driver is loaded, any iSeries Java application will be able to access that non-DB2 data with standard JDBC calls.

The other industry standard solution available to iSeries customers is the IBM DB2 Information Integrator (DB2 II) product. This product allows you to use any iSeries SQL interface (SQL embedded in RPG, JDBC, etc.) to access non-DB2 databases. Here's a sample of the embedded SQL that would be needed to read an Oracle table with DB2 Information Integrator from an iSeries application (assuming the necessary setup has been completed).

EXEC SQL CONNECT TO remotedb;
EXEC SQL SELECT custpref INTO :locpref FROM orcustomer WHERE custid=22;

DB2 Information Integrator does not run natively on OS/400; it requires a Windows or UNIX server. Running DB2 II on an Integrated xSeries Server would be a natural solution for most iSeries customers. To learn more about the IBM DB2 II solution, visit the DB2 Universal Database for iSeries Web site.

Kent Milligan is DB2 UDB Technology Specialist on IBM's eServer Solutions Enablement team. He spent the first seven years at IBM as a member of the DB2 development team in Rochester. He can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS