Fetch data from a REF CURSOR

import sqlj.runtime.*;
import sqlj.runtime.ref.*;
import java.sql.*;
public class SQLJTst6 {
#sql public static iterator EmpIter (int empno, String ename);
public static void main(String[] args) {
Connection c = null;
String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
String userid = "scott";
String passwd = "tiger";
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
c = DriverManager.getConnection(URL, userid, passwd);
System.out.println("Successfully conencted to Oracle...");
// You need to set a Context for SQLJ, otherwise -
//    SQLException: found null connection context
DefaultContext.setDefaultContext( new DefaultContext(c));
// Get REF CURSOR from database
EmpIter iter;
#sql iter = { VALUES(emp_pkg.getRefCursor()) };
// Fetch values from REF CURSOR
while (iter.next()) {
String empname = iter.ename();
int    empnum  = iter.empno();
System.out.println("Empno# " + empnum + ", ename= " + empname);
}
iter.close();
// Close the database connection
#sql { rollback work };
c.close();
System.out.println("Disconected...");
} catch (SQLException e) {
e.printStackTrace();
}
}
}

Syed