|
I've got an idea, Lim. How about defining a data structure that you pass a pointer to. The data structure looks like this: d SQLVar ds d vartype 3u 0 d alphavar 64 d binary 20u 0 overlay(alphavar) d decimal 30s15 overlay(alphavar) d logical n overlay(alphavar) Your getColumn routine would take a pointer to this data structure, and then would load the data depending on the column type. The vartype field would get set to identify the type of data coming back. Obviously my little data structure has some specific limitations, such as a maximum alpha field size of 64. You'd have to set the limits as you saw fit. You might also want to have an error code field just in case (for example, if you had a data type such as BLOB that you couldn't handle or if the data exceeded your limits). This is about the cleanest way I can figure out how to do this. Your application would call the service program's getColumn method with the column index (or name) and a pointer to this structure. Your service program would be responsible for passing the data structure to the Java method as an array of 3u0 bytes, and the Java method would get the column value into a Java variable using standard JDBC routines and then use an appropriately initialized AS400Structure object to convert the Java variable (along with the varitype field and any other information) into the array of bytes. Joe > -----Original Message----- > From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l- > bounces@xxxxxxxxxxxx] On Behalf Of Lim Hock-Chai > Sent: Friday, December 30, 2005 11:26 AM > To: Java Programming on and around the iSeries / AS400 > Subject: RE: Generic java class that will allow RPG/RPGSQLE program > toaccess non-iSeries Data > > - My plan is to create a java class as mentioned in the original thread. > - I'll then create a RPG service program with all the necessary export > procedures to access all those java methods. This will hide the complex > coding needed to call java method. > > *** > The biggest concern is column mapping. I have no clue as how to create > a generic getColumn() that convert the coulmn data into a RPG variable. > > > > -----Original Message----- > From: java400-l-bounces@xxxxxxxxxxxx > [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of David Gibbs > Sent: Friday, December 30, 2005 10:55 AM > To: Java Programming on and around the iSeries / AS400 > > Another possibility ... and I have *ZERO* idea how hard this would be to > implement .. would be to try and do the JDBC request to the other > database directly from RPG using prototyped java calls. > > Just a thought. > > david > > -- > This is the Java Programming on and around the iSeries / AS400 > (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/java400-l > or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a > moment to review the archives at http://archive.midrange.com/java400-l. > > > -- > This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) > mailing list > To post a message email: JAVA400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/java400-l > or email: JAVA400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com 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.