× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



With nobody answering on the RPG list . . .

I'm having difficulty adding an RPG front-end for the DatabaseMetaData.getIndexInfo() method to JDBCR4.

Given that the following Java fragment:
DatabaseMetaData dbmd = conn.getMetaData();
ResultSet indexInfo = dbmd.getIndexInfo(null, "AQUESTVIEW", "VIEWCUS",
true, true);
while(indexInfo.next()){
System.out.println(" " + indexInfo.getString(5)
+ " " + indexInfo.getString(6)
+ " " + indexInfo.getShort(7)
+ " " + indexInfo.getShort(8)
+ " " + indexInfo.getString(9)
+ " " + indexInfo.getString(10));
}

produces the expected output of:
AQUESTVIEW VIEWCUS 3 1 CUNMBR A
null null 0 0 null null

can anybody suggest a reason (other than my own inexperience with front-ending Java for RPG) why the following blows up when executed:

(in JDBCR4):
D getIndexInfo...
D PR ExtProc(*JAVA:
D 'java.sql.DatabaseMetaData':
D 'getIndexInfo')
D like(ResultSet)
D catalog like(jString) const
D schema like(jString) const
D table like(jString) const
D unique 1N value
D approximate 1N value
. . .
P JDBC_GetIndexInfo...
P B export
D JDBC_GetIndexInfo...
D PI like(ResultSet)
D dbmd like(DatabaseMetaData) const
D catalog 32767A varying const options(*varsize)
D schema 32767A varying const options(*varsize)
D table 32767A varying const options(*varsize)
D unique 1N
D approximate 1N
D temp s like(ResultSet)
D rs s like(ResultSet)
D cat s like(jString)
D sch s like(jString)
/free
jdbc_begin_object_group(50);
if (catalog = '*NULL');
cat = *NULL;
else;
cat = s(catalog);
endif;
if (schema = '*NULL');
sch = *NULL;
else;
sch = s(schema);
endif;
monitor;
temp = getIndexInfo(dbmd: cat: sch: s(table):
unique: approximate);
jdbc_end_object_group(temp: rs);
on-error;
jdbc_end_object_group();
return *NULL;
endmon;

return rs;
/end-free
P E

and in the calling program:

rs = JDBC_GetIndexInfo(dbmd: '*NULL': %TRIM(MPLIBR): %TRIM(MPFILE):
*ON: *ON);
jdbc_freeResult(rs);

(Note that, as with my front-end for DatabaseMetaData.getPrimaryKeys(), there is code in the front-end to turn the quoted string '*NULL' into an actual *NULL passed to the Java method.)

It blows up at the freeResult call. In my own miniscule experience with expanding JDBCR4, this usually happens if the result set passed is null. That suggests that I've screwed up something in the call to getIndexInfo, such that it's returning *NULL instead of a result set.

But what?

--
JHHL

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

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.