The hard part is still handling column types.  Whether you use embedded SQL
or convert the types using the Java interface capabilities of RPG, you still
need at some point to know the type of data you're reading.  RPG does not
handle variable type data very well.

So, if you already know the layout of the result set, then you can use the
JTOpen classes to convert each row into a data structure.  Very easy to do.
The hard part is the error checking; you should probably check the result
set metadata to make sure you're getting the types of data you expect.

If you don't know the types, then you need to query the metadata of the
result set and have some sort of CASE logic in your RPG to handle the
various types of data.  Then you'd probably have to handle each column in
each row one at a time.


> From: David Gibbs
> Lim Hock-Chai wrote:
> > Want to get an idea of how hard would be it to create a generic java
> > class that provide RPG/RPGSQLE program to access non-iSeries database.
> My first thought when I saw this question was to create a sql proxy
> application in java.
> Basically, your RPG program would send the java app a SQL request via
> data queue, and then have the java app execute the sql request on the
> other database, parse the meta data, create a table on the iSeries
> matching the result set, and write the results to that iSeries table.
> The RPG app would then read the results from the generated table and
> drop the table when done.
> Obviously it's more complex than that ... but that's the gist of my idea.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.