Vous êtes sur la page 1sur 5

German Programmer Devises Novel Way to Access Any Remote DB from IBM i

Written by Chris Smith Friday, 19 November 2010 00:00 - Last Updated Friday, 19 November 2010 00:00

Still a work in progress, ArdGate allows users to insert, update, and delete data with interactive SQL, QMQRY, and embedded SQL. If you want to access data in the DB2 for i database from a remote computer, it's not that difficult. However, if you are working on an iSeries and you wish to connect to a remote database server to manipulate data, it can be a bit of a challenge. "Using ODBC, you can connect from another system to the AS/400 but not in the opposite direction," says Dieter Bender , an independent RPG programmer in Wettenberg, Germany.Bender has been active in the MC Press RPG Forums lately sparring with author Tom Snyder ( Advanced Integrated RPG ) over various approaches to utilizing Java in RPG programs. Both are RPG programmers who work on the iSeries and who have become expert in utilizing Java to perform certain jobs that are cumbersome using RPG. Bender has developed and released to open source a database driver for DB2 that he says IBM should have introduced ages ago. "If IBM would have announced universal database connectivity with IBM i 7.1 from DB2 for i to all databases on the market through Add RDB Directory Entry (ADDRDBDIRE PORT [*JDBC]), this would have been the top announcement," Bender says. "It's no problem talking to another database from an AS/400 Java program," says Bender. "But from the most-used languageslike RPG and COBOLit's not possible to talk with a remote database using SQL. It's not offered by IBM; they don't have this on i," he says. Using RPG or COBOL, besides DB2, only Oracle can be accessed by normal SQL using Oracle Access Manager. Bender says he came up with the idea to address this deficiency while programming at a business client, but he knew that if he created a unique driver while under contract, his employer would likely lay claim to the copyright. "If I'm working as a consultant for a large company, normally they try to get the copyright on everything that I write," he says. So Bender released his driver into open source. He still introduces it to companies where he works doing customizations, but they can't hang onto it and prevent its use elsewhere.

1/5

German Programmer Devises Novel Way to Access Any Remote DB from IBM i
Written by Chris Smith Friday, 19 November 2010 00:00 - Last Updated Friday, 19 November 2010 00:00

ArdGate , Bender's open-source solution, closes the gap and makes all databases on the market available for normal SQL access, regardless of whether it's done by interactive SQL, QMQRY, or embedded SQL, says Bender. ArdGate, which you can find nested in the download from the link above and which Bender says is still a "work in progress," is mostly written in Java but has a small RPG interface layer that serves as a connector to the SQL client integration exit. It is based on (and uses) Bender's "high performance" RPG-to-Java engine, AppServer4RPG. Bender says that the engine uses one pre-started Java Virtual Machine (JVM) to serve multiple clients in a multithreaded environment. He says the engine supports highly scalable usage and fast response times.

Figure 1: The ArdGate architecture shows connections with the remote DB. (Click images to enlarge.) Enabling connections to a remote database is done in the normal way and begins by adding an entry to the remote database directory, says Bender. With the entry, the connector JVAGATE is registered as *ARDPGM and all SQL statements regarding this remote database are routed by DB2 to the exit program. Most of the work is done by the Java portion of the application. To

2/5

German Programmer Devises Novel Way to Access Any Remote DB from IBM i
Written by Chris Smith Friday, 19 November 2010 00:00 - Last Updated Friday, 19 November 2010 00:00

complete the registration, two lines must be added to the configuration of ArdGate, specifying how to access the database and listing the name of the JDBC driver.

Figure 2: Enabling connections to a remote database is done in the normal way and begins by adding an entry to the remote database directory. Installation is simplified by providing the RPG part ready for use as savefile and repackaging the Java part as a Web archive for easy deployment to a Web container such as WebSphere or Tomcat. It can be installed as a standalone Java application, but that entails adjusting classpath settings to add additional JDBC drivers. Once installed, you can connect to the database by its name in the remote database directory. Multiple connections are possible to different databases within the same activation group or to the same database in different activation groups. ArdGate serves multiple connections from different jobs at the same time by multithreading, Bender says.

3/5

German Programmer Devises Novel Way to Access Any Remote DB from IBM i
Written by Chris Smith Friday, 19 November 2010 00:00 - Last Updated Friday, 19 November 2010 00:00

Figure 3: Above is an example program to access a remote database using ArdGate. The current release (Milestone 3) of ArdGate has the following features: - Select, insert, update, delete with interactive SQL - Field selection with F4 from STRSQL - INTEGER, types as provided DECIMAL, by the target NUMERIC, database CHAR, VARCHAR, DATA, TIME, TIMESTAMP data - Support for null values and null indicators in embedded SQL - Insert with host variables - Searched update and delete with host variables - Cursor definition with prepare and host variables - Fetch single line (no scrollable cursor) Bender says positioned planned, he delete, says. Milestone and procedure 4 should contain call. For declare Milestone cursor, 5, support select into, for commitment positioned update, control is "The mechanism every database part, the database. AS/400. Java which original job," application implemented The he is to Talking project tied says. make result, to After with the via is calling says nearly in the database the trying Java, Bender, Java client remote two a Bender routines workaround integration years name is database you decided old," infrom can the exit, says using is file remote RPG upon done and SQL Bender. Apache without the by database statements Bender's SQL Java "The having Derby, client application first directory, Java as a an part integration Java you open-source application. was would sends talks Virtual to with exit build with DB2 Machine relational point The the a a data local remote other from to in

4/5

German Programmer Devises Novel Way to Access Any Remote DB from IBM i
Written by Chris Smith Friday, 19 November 2010 00:00 - Last Updated Friday, 19 November 2010 00:00

DB2 have Germany. one i offers more To try a that ArdGate range could of and prove services AppServer4RPG, very touseful communicate thanks visit to with an other RPG programmer IBM from i users a small may town now in rpg/ for http://sourceforge.net/projects/appserver4 . To databases. contact Dieter Bender, write @bender-dv.de db . as/400, os/400, iseries, system i, i5/os, ibm i, power systems, 6.1, 7.1,

5/5

Vous aimerez peut-être aussi