title: Insert & fetch java.time.LocalDate objects to/from an SQL database such as H2
body: <p>How to insert and fetch <a href="https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html" rel="noreferrer">java.time</a> types such as <a href="https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html" rel="noreferrer"><code>LocalDate</code></a> via <a href="https://en.wikipedia.org/wiki/Java_Database_Connectivity" rel="noreferrer">JDBC</a> to an SQL database such as the <a href="http://h2database.com/" rel="noreferrer">H2 Database Engine</a>? </p>
  
  <p>The old way using <a href="https://docs.oracle.com/javase/8/docs/api/java/sql/PreparedStatement.html#setDate-int-java.sql.Date-" rel="noreferrer"><code>PreparedStatement::setDate</code></a> and <a href="https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html#getDate-int-" rel="noreferrer"><code>ResultSet::getDate</code></a> works for the legacy <a href="https://docs.oracle.com/javase/8/docs/api/java/sql/Date.html" rel="noreferrer"><code>java.sql.Date</code></a> type. I want to avoid using these troublesome old date-time classes.</p>
  
  <p>What is the modern way for sending java.time types through a <a href="https://en.wikipedia.org/wiki/JDBC_driver" rel="noreferrer">JDBC driver</a>?</p>