public int write(Connection conn,String outputFileName,String sql,String charset) throws SQLException {
  Statement stat=conn.createStatement();
  ResultSet rs=stat.executeQuery(sql);
  int rows=write(outputFileName,rs,charset);
  stat.close();
  return rows;
}

public int write ( Connection conn , String outputFileName , String sql , String charset ) throws SQLException { Statement stat = conn . createStatement ( ) ; ResultSet rs = stat . executeQuery ( sql ) ; int rows = write ( outputFileName , rs , charset ) ; stat . close ( ) ; return rows ; }
writes the result set of a query to a file in the csv format .
