title: Reading database with JDBC
body: <p>I created a table using JDBC and SQLite in one of my programs. Now I'm trying to read specific values from the database. I'm trying to get the very last ordernumber, but I get an error. I've put my code below. Not sure what's wrong: </p>
  
  <pre><code>try {
      String sql = "SELECT ordernumber FROM orderTable ORDERBY ordernumber LIMIT 1 DESC";
      Connection connection = DriverManager.getConnection(url);
      Statement stmt = connection.createStatement();
      ResultSet rs = stmt.executeQuery(sql);
      System.out.println(rs.getInt("ordernumber"));
  } catch (SQLException e) {
      System.out.println(e.getMessage());
  }
  </code></pre>