Table Of Contents
Presentation Handout

I give a 75 minute talk at conferences and user groups about using JDBC drivers from RPG programs to access external databases. This presentation aims to discuss:

  1. Why I choose this method.
  2. How to find/install JDBC drivers.
  3. How to write the RPG code to call them.

Even if you're not able to attend one of my talks, you can download a PDF copy of my Powerpoint sldes (used as a handout for attendees) here:

Accessing External Databases from RPG

JDBC from RPG Articles by Scott Klement

Over the years, I've published many articles about accessing external databases using JDBC from RPG. Sadly, the company who published these has taken them offline, so these links will not work. I've left them here in the event that you wish to look them up in a library, archive CD/DVD, or on the Internet Archive web site, you will know the original article name and link.

MySQL Database Access from RPG

This was my original article on external database access, it was aimed at MySQL databases only. It describes where to get the driver, how to install it into your CLASSPATH, how to connect, and how to run both immediate and prepared SQL statements from RPG.

JDBC from RPG

Here, I took my original MySQL code, and expanded it so you can load any JDBC driver you wish. All the same features as the previous article, but able to access any sort of database.

Handle Null Values in JDBC from RPG

I added support for handling Null database values to the JDBCR4 service program, and described the new support in this article.

Access MS SQL Server Database from an RPG Program

This article provided sample code written by Jon Juracich that demonstrates how to connect to and run SQL statements against a Microsoft SQL Server database from RPG. This uses Microsoft's JDBC driver (which I do not recommend) but the example of running SQL statements is still useful. (But see below.)

SQL Server JDBC Driver Tip (A Better JDBC Driver for MS SQL Server)

After handling many complaints/problems with Microsoft's SQL Server JDBC driver, a developer named Hugo Cantor gave me a great tip: Use the open source jTDS driver with SQL Server, it works better! This article explains where to get the jTDS driver and the (minor) changes that you need to make to Jon Juracich's example to make it work with the jTDS driver.

Access Oracle Databases from an RPG Program

This article provided sample code written by Vincent Taquin that demonstrates how to connect to and run SQL statements against an Oracle database from RPG.

JDBC From RPG Enhancements

This article takes what I learned from the earlier articles and attempts to combine it all into one. It also adds support for result set meta-data and commitment control to the JDBCR4 service program.

JDBC From RPG by Column Name

While previous articles showed how to access database columns (fields) by number, this article adds support for retriving the column values by name instead.

JDBC from RPG with Unicode Support

Previous articles asked JDBC to convert all char/varchar columns to EBCDIC when reading it into an RPG program. This caused problems, especially for international users. This article adds Unicode support to JDBCR4, allowing support for any character in the Basic Multilingual Plane.

Downloads

You can download my JDBCR4 utility here. This utility helps you use JDBC drivers from your RPG programs.

Date Utility Size Description
14 May 2009 JDBCR4 and Example Code 38 KB RPG Utilities for JDBC
Help & Support

This is a community-supported product. Support is provided through public forums and mailing lists. The following public forums/lists are known to be good sources for help with JDBCR4: