title: How to catch exceptions in sql loader
body: <p>I'm using sql loader to load large amount of data from csv into oracle database. I write a java program running sql loader with restful. Here is the program</p>
  
  <p><strong>FileUploadController</strong></p>
  
  <pre><code>       @PostMapping("/getCsv")
          public ResponseEntity&lt;?&gt; getAll() {
             try {
                 String path = context.getRealPath("/WEB-INF/uploaded");
                 String fileName = "sqlldr_Employees.ctl ";
  
                  String sqlldrCmd = "Sqlldr trung/tbtrung control = "+ path + "/" + fileName +"log=d:/bt.log skip=1" + " data=" + path + "/*.csv";
                  System.out.println(sqlldrCmd.replace("\\", "/"));
                  System.out.println("SQLLDR Started ....... ");
                  Runtime rt = Runtime.getRuntime();
                  Process proc = rt.exec(sqlldrCmd.replace("\\", "/"));
                  System.out.println("SQLLDR Ended ........  ");
                  return ResponseEntity.status(HttpStatus.OK).build();
                } catch (Exception e) {
                    return ResponseEntity.notFound().build();
              }
          }
  </code></pre>
  
  <p>I use the postman to test the API: /getCsv. However, if the upload is successful or not it still returns HTTP Status 200. Sometimes status is 200 but data from csv has not been imported into the database. How do I know if the csv data has been imported into the database? I have read that the sql loader has an option of log =. However, I would like if uploading the data from csv to the database, there will be a message displayed to the user and if not successful there is also such a message.I want catch event from sql loader. How do I know if my data has uploaded successfully or error? Please help. Thank you.</p>