Code example for ResultSet

Methods: closegetBooleangetLonggetStringnext

0
		DownloadAlbum downloadAlbum = new DownloadAlbum();
		PreparedStatement sta = conn.prepareStatement("SELECT DA.ID, DA.NAME, DA.IMAGE, DA.ISACTIVE FROM DOWNLOAD_ALBUM DA WHERE DA.ID = ? ");
		sta.setLong(1, this.downloadAlbumId);
		ResultSet rs = sta.executeQuery();
		 
		if (rs.next()) {
			downloadAlbum.setId(rs.getLong(1));
			downloadAlbum.setName(rs.getString(2));
			downloadAlbum.setImage(rs.getString(3));
			downloadAlbum.setActive(rs.getBoolean(4));
		} 
		 
		rs.close();
		sta.close();
		 
		return downloadAlbum;
	} 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE