How do I create iterator classes and connection context classes?
SQLJ provides syntax for declaring (i.e., creating) iterator classes and connection context classes. Here is an example of a named iterator class declaration (with a String column named ename and a double column named sal): #sql public iterator NamedIterClass (String ename, double sal); Here is an example of a positional iterator class declaration: #sql public iterator PosIterClass (String, sal); And here is an example of a connection context class declaration: #sqlj public context MyContextClass; You can declare an iterator or connection context class wherever it would be legal to define a class of any kind. When the SQLJ translator encounters an iterator declaration or connection context declaration, it inserts a class definition into the .java output file. Note: If you declare an iterator class or connection context class at the class level or nested-class level, it might be advisable to declare it public static as opposed to simply public.