SQLJ

SQLJ is an implementation of static SQL to be used with the Java programming language. It was designed by IBM, Oracle, and Sun to eliminate the weaknesses of JDBC. It allows most of the normal SQL language in a Java module, as shown below.

#sql iterator Honors ( String, float); 
Honors honor;
#sql (recs) honor =
    { SELECT STUDENT, SCORE FROM GRADE_REPORTS
    WHERE SCORE >= :limit
    AND ATTENDED >= :days
    AND DEMERITS <= :offences
    ORDER BY SCORE DESCENDING };
while (true) {
    #sql {FETCH :honor INTO :name, :grade };
    if (honor.endFetch()) break;
    System.out.println( name + " has grade " + grade );
    }

The static SQL syntax for Java is easier than JDBC, and the performance is much better than JDBC. It provides popular language support for binary portability ...

Get DB2® Universal Database™ for OS/390™ v7.1 Application Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.