title: How do i add ObservableList obtained from Mysql server to javaFX Tableview?
body: <p>I want to populate JavaFX tableview with the contents of a mysql database. I have created an observable list and added table data in it but i don't know how to display this list in tableview. Here is code for list,</p>
  
  <pre><code>public ObservableList&lt;PatientDto&gt; getAllPatientInfo() {
      ObservableList&lt;PatientDto&gt; list = FXCollections.observableArrayList();
      PreparedStatement ps = null;
      try {
          String sql = "select * from patient_record";
          ps = DbUtil.getConnection().prepareStatement(sql);
          ResultSet rs = ps.executeQuery();
          while (rs.next()) {
              PatientDto patientDto = new PatientDto();
              patientDto.setPid(rs.getInt("PID"));
              patientDto.setPatient_Name(rs.getString("Patient_Name"));
              patientDto.setAddress(rs.getString("Address"));
              patientDto.setAge(rs.getInt("Age"));
              patientDto.setDisease(rs.getString("Disease"));
              patientDto.setDoctor_Name(rs.getString("Doctor_Name"));
              patientDto.setAdmit_Date(rs.getDate("Admit_date"));
              patientDto.setDischarge_Date(rs.getDate("Discharge_Date"));
              list.add(patientDto);
          }
      } catch (SQLException e) {
          e.printStackTrace();
      }
      return list;
  }
  </code></pre>
  
  <p>I am using scene builder for UI and this is interface of my tableview
  <a href="https://i.stack.imgur.com/T0vHF.png" rel="nofollow noreferrer">TableView In scene builder</a></p>
  
  <p>And this is ss of my table in mysql database. <a href="https://i.stack.imgur.com/2XDFD.png" rel="nofollow noreferrer">Table in Mysql server</a>.
  I am newbie in JavaFX so i am finding it difficult to implement available answers. So please describe in detailed manner.</p>