예제 #1
0
파일: jdbc.java 프로젝트: eric62451/aaaaa
 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;
 }
예제 #2
0
파일: jdbc.java 프로젝트: eric62451/aaaaa
 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();
 }