title: java.lang.ClassCastException: class java.sql.Date cannot be cast to java.lang.String
body: <p>I am able to insert the date the insert the data into the database, but when I tried to fetch the data out and show it in the jDateChooser, it showed up the error as the topic stated. why?</p>
  <pre><code>import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  import java.sql.*;
  import java.sql.Connection;
  import java.text.SimpleDateFormat;
  import javax.swing.JOptionPane;
  import javax.swing.table.DefaultTableModel;
  import net.proteanit.sql.DbUtils;
  import java.util.Date;
  </code></pre>
  <p>these are the packages I imported in</p>
  <pre><code>private void DisplayTable(){
          try {
               Class.forName(&quot;com.mysql.jdbc.Driver&quot;);
                 Connection con = DriverManager.getConnection(&quot;jdbc:mysql://localhost:3308/java_his_db&quot;,&quot;root&quot;,&quot;&quot;);
                 String sql = &quot;select * from reservation&quot;;
                 PreparedStatement ps = con.prepareStatement(sql);
                 ResultSet res = ps.executeQuery();
                 jTable_reservation.setModel(DbUtils.resultSetToTableModel(res));
                 
          }catch (Exception e) {
                                     JOptionPane.showMessageDialog(null, e);
                                 }
      }
  </code></pre>
  <p>this is my private void to show the data into jTable</p>
  <pre><code>private void jTable_reservationMouseClicked(java.awt.event.MouseEvent evt) {                                                
      // TODO add your handling code here:
      DefaultTableModel model = (DefaultTableModel)jTable_reservation.getModel();
  
      int rowInd = jTable_reservation.getSelectedRow();
  
      roomID.setText(model.getValueAt(rowInd, 0).toString());
      customerID.setText(model.getValueAt(rowInd, 1).toString());
  
      try {
          Date selectin = new SimpleDateFormat(&quot;yyyy-MM-dd&quot;).parse((String)model.getValueAt(rowInd, 3));
          jDateChooser_in.setDate(selectin);
      } catch (Exception e) {
                                 JOptionPane.showMessageDialog(null, e);
                             }
   
  }  
  </code></pre>
  <p>these are the code I used to fetch the data into text fields.</p>
  <p>the catch exception then showed the error above whenever I clicked one row from the table.</p>
  <p><em><strong>java.lang.ClassCastException: class java.sql.Date cannot be cast to java.lang.String (java.sql.Date is in module java.sql of loader 'platform'; java.lang.string is in module java.base of loader 'boostrap')</strong></em></p>
  <p>how to solve this problem?</p>