I currently have the arraylist from the resultset and I use openCSV library to print as a CSV.
ArrayList<Integer> arlist=new ArrayList<Integer>();
for(i=1;i<30;i++){
for(k=1;k<100;k++){
String sql="select count(id) where day=?"
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.setInt(1,k);
ResultSet rs=rs.getInt(1);
int count=rs.getInt(1);
arlist.add(count);
}
CSVWriter writer=new CSVWriter(new FileWriter("/home/user/file"+i+".csv"),',')
writer.writeNext(arlist.toArray(new String [0]));
writer.close();
arlist.clear();
}
But the problem is the CSV is a 1 line CSV with 100 columns.Instead of this I need a 100 line CSV with 1 column.(size of array list is 100).Any help is Appreciated.