Exemple #1
0
 public ArrayList<Listing> getAllListing() throws SQLException {
   start();
   rs = stmt.executeQuery("SELECT * FROM listingInfo");
   ArrayList<Listing> rtrn = new ArrayList<Listing>();
   while (rs.next()) {
     Listing temp = new Listing();
     temp.setUserName(rs.getString(2));
     temp.setRacquetID(rs.getInt(3));
     temp.setPrice(rs.getDouble(4));
     temp.setNewOrOld(rs.getString(5));
     temp.setDateListed(rs.getDate(6));
     temp.setDateSold(rs.getDate(7));
     // temp.setSellerRating(rs.getInt(8));
     temp.setDescription(rs.getString(9));
     temp.setPicURL(rs.getString(10));
     rtrn.add(temp);
   }
   close();
   return rtrn;
 }
Exemple #2
0
 public static void main(String[] args) throws SQLException, ClassNotFoundException {
   Connection conn =
       DriverManager.getConnection("jdbc:mysql://localhost:3306/racqual", "root", "99643333");
   Statement stmt = conn.createStatement();
   ResultSet rs = stmt.executeQuery("SELECT * FROM listingInfo");
   ArrayList<Listing> rtrn = new ArrayList<Listing>();
   while (rs.next()) {
     Listing temp = new Listing();
     temp.setUserName(rs.getString(2));
     temp.setRacquetID(rs.getInt(3));
     temp.setPrice(rs.getDouble(4));
     temp.setNewOrOld(rs.getString(5));
     temp.setDateListed(rs.getDate(6));
     temp.setDateSold(rs.getDate(7));
     // temp.setSellerRating(rs.getInt(8));
     temp.setDescription(rs.getString(9));
     temp.setPicURL(rs.getString(10));
     rtrn.add(temp);
   }
   rs.close();
   stmt.close();
   conn.close();
 }