public static void main(String[] args) 
	{
		Connection 							conn = null;
		Statement 							stmt = null;
		PreparedStatement 				   pstmt = null;
		ResultSet 							  rs = null;
		FileReader 							  fr = null;
		BufferedReader 						  br = null;
		String 								line = null;
		Hashtable<Integer, RecPair>			recs = null; 
		try
		{
			Class.forName("com.mysql.jdbc.Driver");
			conn    = DriverManager.getConnection(url, user, password);
			stmt	= conn.createStatement();
			pstmt   = conn.prepareStatement(sql1);
			fr		= new FileReader("data/items.csv");
			br		= new BufferedReader(fr);
			recs	= new Hashtable<Integer, RecPair>();
			while ((line = br.readLine()) != null)
			{
				int iid			= Integer.parseInt(line);
				StringBuffer sb = new StringBuffer();
				pstmt.setInt(1, iid);
				rs				= pstmt.executeQuery();
				while (rs.next())
				{
					if(sb.length() != 0)
					{
						sb.append("," + rs.getString(1));
					}
					else
					{
						sb.append(rs.getString(1));
					}
				}
				rs.close();
				
				if(sb.length() != 0)
				{
					String 		sql = sql_left + sb.toString() + sql_right;
					RecPair	    rec = recs.get(iid);
					rs				= stmt.executeQuery(sql);
					if (rec == null)
					{
						rec = new RecPair();
						recs.put(iid, rec);
					}
					
					while (rs.next())
					{
						int 	 rid = rs.getInt(1);
						double value = rs.getDouble(2);
						rec.getRids().add(rid);
						rec.getValues().add(value);
					}
					rs.close();
				}
			}
			pstmt.close();
			stmt.close();
			conn.close();
			br.close();
			fr.close();
			
			FileOutputStream fos   = new FileOutputStream("recs.jobj");
			ObjectOutputStream oos = new ObjectOutputStream(fos);
			oos.writeObject(recs);
			oos.close();
			fos.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}