import java.sql.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;

import java.net.URI;
import java.net.URISyntaxException;

import static spark.Spark.*;
import spark.template.freemarker.FreeMarkerEngine;
import spark.ModelAndView;
import static spark.Spark.get;

import com.heroku.sdk.jdbc.DatabaseUrl;

public class Main {

  public static void main(String[] args) {

    port(Integer.valueOf(System.getenv("PORT")));
    staticFileLocation("/public");

    get("/hello", (req, res) -> "Hello World");

    get("/", (request, response) -> {
            Map<String, Object> attributes = new HashMap<>();
            attributes.put("message", "Hello World!");

            return new ModelAndView(attributes, "index.ftl");
        }, new FreeMarkerEngine());

    get("/db", (req, res) -> {
      Connection connection = null;
      Map<String, Object> attributes = new HashMap<>();
      try {
        connection = DatabaseUrl.extract().getConnection();

        Statement stmt = connection.createStatement();
        stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)");
        stmt.executeUpdate("INSERT INTO ticks VALUES (now())");
        ResultSet rs = stmt.executeQuery("SELECT tick FROM ticks");

        ArrayList<String> output = new ArrayList<String>();
        while (rs.next()) {
          output.add( "Read from DB: " + rs.getTimestamp("tick"));
        }

        attributes.put("results", output);
        return new ModelAndView(attributes, "db.ftl");
      } catch (Exception e) {
        attributes.put("message", "There was an error: " + e);
        return new ModelAndView(attributes, "error.ftl");
      } finally {
        if (connection != null) try{connection.close();} catch(SQLException e){}
      }
    }, new FreeMarkerEngine());

  }

}

@@ -297,39 +297,177 @@
 ort 
-com.heroku.sdk.jdbc.DatabaseUrl
+static javax.measure.unit.SI.KILOGRAM;%0Aimport javax.measure.quantity.Mass;%0Aimport org.jscience.physics.model.RelativisticModel;%0Aimport org.jscience.physics.amount.Amount
 ;%0A%0Ap
@@ -652,21 +652,176 @@
  -%3E 
-%22Hello World%22
+%7B%0A          RelativisticModel.select();%0A          Amount%3CMass%3E m = Amount.valueOf(%2212 GeV%22).to(KILOGRAM);%0A          return %22E=mc%5E2: 12 GeV = %22 + m.toString();%0A        %7D
 );%0A%0A
@@ -1235,30 +1235,8 @@
 n = 
-DatabaseUrl.extract().
 getC
@@ -2040,18 +2040,16 @@
       %7D%0A
-  
   %7D, new
@@ -2076,10 +2076,574 @@
 ;%0A%0A  %7D%0A%0A
+  private static Connection getConnection() throws URISyntaxException, SQLException %7B%0A    URI dbUri = new URI(System.getenv(%22DATABASE_URL%22));%0A    int port = dbUri.getPort();%0A    String dbUrl = %22jdbc:postgresql://%22 + dbUri.getHost() + %22:%22 + port + dbUri.getPath();%0A%0A    if (dbUri.getUserInfo() != null) %7B%0A      String username = dbUri.getUserInfo().split(%22:%22)%5B0%5D;%0A      String password = dbUri.getUserInfo().split(%22:%22)%5B1%5D;%0A      return DriverManager.getConnection(dbUrl, username, password);%0A    %7D else %7B%0A      return DriverManager.getConnection(dbUrl);%0A    %7D%0A  %7D%0A%0A
 %7D%0A

Update Main.java