title: Resultset into CSV?
body: <p>I am using opencsv library to dump oracle data into csv file.</p>
  
  <p>I am using below code:</p>
  
  <pre><code>    private void generateCSVFile() {
  
      try {
          Class.forName("oracle.jdbc.driver.OracleDriver");
          String url = "jdbc:oracle:thin:@localhost:1521:XE";
          Connection con = DriverManager.getConnection(url, "system", "admin");
          PreparedStatement ps = con.prepareStatement("select * from T_USER_DETAILS",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE,ResultSet.HOLD_CURSORS_OVER_COMMIT);
          ResultSet rs = ps.executeQuery();
          if(rs.next()){
              System.out.println("Name = "+rs.getString(2));
          }
  
          rs.beforeFirst();
          CSVWriter writer = new CSVWriter(new FileWriter("Test.csv"),'\t');
  
          writer.writeAll(rs, true);
          JOptionPane.showMessageDialog(null, "CSV Created!","Success!",JOptionPane.INFORMATION_MESSAGE);
  
      } catch (Exception ex) {
          Logger.getLogger(BackupDB.class.getName()).log(Level.SEVERE, null, ex);
      }
  
  }
  </code></pre>
  
  <p>but, when i executing this code. csv file is created but there is no content in that file. (note result set prints the 2 column value in console).</p>
  
  <p>Thanks in Advance.</p>