code: public static void main(String args[]) {
          String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver";
          String url = "jdbc:db2:sample";
          String user = "Murali";
          String pass = "ibm";
          String querystring = "Select * from Murali.department";
  
          try {
              ConnectionProperties cp = new ConnectionProperties(dbDriver, url, user, pass);
              Query query = new Query(cp, querystring);
              QueryResults qs = query.execute();
              System.out.println("Number of rows = " + qs.size());
              for (int i = 0; i < qs.size(); i++) {
                  String dept = qs.getValue("DEPTNAME", i);
                  System.out.println("Department:" + dept);
              }
              /*Enumeration enum= qs.getRows();
              while (enum.hasMoreElements())
                {
                QueryRow qr = (QueryRow)enum.nextElement();
                String fn = qr.getValue("DEPT");
                String ln = qr.getValue("DEPTNAME");
              //  String bd = qr.getValue("BIRTHDATE");
                //String sal = qr.getValue("SALARY");
                System.out.println(fn + " " + ln);
              
                }*/ // while
          } // try
          catch (Exception e) {
              //com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.main", "310");
              System.out.println("Exception:: " + e.getMessage());
          } //catch
      }
docs: This method was created in VisualAge.
  @param args java.lang.String[]