|
D createStatement2...
D PR ExtProc(*JAVA:
D 'java.sql.Connection':
D 'createStatement')
D like(Statement)
D RSTYPE 10I 0 VALUE
D RSCONCUR 10I 0 VALUE
P JDBC_ExecQrySc B export(1005 is, at least according to the JavaDocs,
D JDBC_ExecQrySc PI like(ResultSet)
D conn like(Connection) const
D sql 32767A varying const options(*varsize)
D stmt s like(Statement)
D temp s like(ResultSet)
D rs s like(ResultSet)
/free
jdbc_begin_object_group(50);
monitor;
stmt = createStatement2( conn: 1005: 1007);
temp = executeQuery( stmt : s(sql));
jdbc_end_object_group(temp: rs);
on-error;
jdbc_end_object_group();
return *NULL;
endmon;
return rs;
/end-free
P E
D b4FirstRec.... . .
D PR 1N ExtProc(*JAVA:
D 'java.sql.ResultSet':
D 'beforeFirst')
P JDBC_B41stRow B export
D JDBC_B41stRow PI 1N
D rs like(ResultSet)
/free
monitor;
return B4FirstRec(rs);
on-error;
return *OFF;
endmon;
/end-free
P E
while(rs.next()){
//Retrieve by column name
int id = rs.getInt("id");
int age = rs.getInt("age");
String first = rs.getString("first");
String last = rs.getString("last"); //Display values
System.out.print("ID: " + id);
System.out.print(", Age: " + age);
System.out.print(", First: " + first);
System.out.println(", Last: " + last); } rs.beforeFirst();
while(rs.next()){
//Retrieve by column name
int id = rs.getInt("id");
int age = rs.getInt("age");
String first = rs.getString("first");
String last = rs.getString("last");
//Display values
System.out.print("ID: " + id);
System.out.print(", Age: " + age);
System.out.print(", First: " + first);
System.out.println(", Last: " + last);
}
rs = jdbc_ExecQrySc( conn : 'Select CUNMBR,CUNAME'
+ ' from AQUESTVIEW/VIEWCUS'
+ ' where CUNMBR > 700000'
);
dow (jdbc_nextRow(rs));
CUSNUM = %int(jdbc_getCol(rs: 1));
NAME = jdbc_getCol(rs: 2);
except LINE;
enddo;
dsply jdbc_b41stRow(rs);
dow (jdbc_nextRow(rs));
CUSNUM = %int(jdbc_getCol(rs: 1));
NAME = jdbc_getCol(rs: 2);
except LINE;
enddo;
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.