title: Correct way to use copy Postgres jdbc
body: <p>Unable to use copy command with jdbc Postgres. Whats wrong with the below code snippet sample.</p>
  
  <pre><code>public boolean loadReportToDB(String date) {
          // TODO Auto-generated method stub
          Connection connection = DBUtil.getConnection("POSTGRESS");
          String fileName = "C:/_0STUFF/NSE_DATA/nseoi_" + date + ".csv";
          String sql = "\\copy fno_oi FROM 'C:\\_0STUFF\\NSE_DATA\\nseoi_27102017.csv' DELIMITER ',' CSV header";
          try {
              PreparedStatement ps = connection.prepareStatement(sql);
              System.out.println("query"+ps.toString());
              int rowsaffected = ps.executeUpdate();
              System.out.println("INT+" + rowsaffected);
              return true;
          } catch (SQLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
          return false;
      }
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>org.postgresql.util.PSQLException: ERROR: syntax error at or near "\"
    Position: 1
      at org.
  </code></pre>
  
  <p>if we use </p>
  
  <pre><code>String sql = "copy fno_oi FROM 'C:\\_0STUFF\\NSE_DATA\\nseoi_27102017.csv' DELIMITER ',' CSV header";
  </code></pre>
  
  <p>then no rows are updated </p>
  
  <p>postgres version postgresql-10.0-1-windows-x64</p>