import static spark.Spark.get;
import static javax.measure.unit.SI.KILOGRAM;
import static spark.Spark.port;
import static spark.Spark.staticFileLocation;

import javax.measure.quantity.Mass;
import org.jscience.physics.model.RelativisticModel;
import org.jscience.physics.amount.Amount;

/**
 * Created by DJMojo on 14/05/16.
 */
public class Main {

    public static void main(String[] args) {

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

        get("/hello", (req, res) -> {
            RelativisticModel.select();

            String energy = System.getenv().get("ENERGY");

            Amount<Mass> m = Amount.valueOf(energy).to(KILOGRAM);
            return "E=mc^2: "+energy+" = " + m.toString();
        });
    }

}

@@ -184,16 +184,57 @@
 ty.Mass;
+%0A%0Aimport com.heroku.sdk.jdbc.DatabaseUrl;
 %0Aimport 
@@ -321,16 +321,283 @@
 .Amount;
+%0Aimport spark.ModelAndView;%0Aimport spark.template.freemarker.FreeMarkerEngine;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0Aimport java.sql.Statement;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.Map;
 %0A%0A/**%0A *
@@ -1031,16 +1031,20 @@
 2: %22
-+
+ + 
 energy
-+
+ + 
 %22 = 
@@ -1072,16 +1072,1194 @@
      %7D);
+%0A%0A        get(%22/db%22, (req, res) -%3E %7B%0A            Connection connection = null;%0A            Map%3CString, Object%3E attributes = new HashMap%3C%3E();%0A            try %7B%0A                connection = DatabaseUrl.extract().getConnection();%0A%0A                Statement stmt = connection.createStatement();%0A                stmt.executeUpdate(%22CREATE TABLE IF NOT EXISTS ticks (tick timestamp)%22);%0A                stmt.executeUpdate(%22INSERT INTO ticks VALUES (now())%22);%0A                ResultSet rs = stmt.executeQuery(%22SELECT tick FROM ticks%22);%0A%0A                ArrayList%3CString%3E output = new ArrayList%3CString%3E();%0A                while (rs.next()) %7B%0A                    output.add( %22Read from DB: %22 + rs.getTimestamp(%22tick%22));%0A                %7D%0A%0A                attributes.put(%22results%22, output);%0A                return new ModelAndView(attributes, %22db.ftl%22);%0A            %7D catch (Exception e) %7B%0A                attributes.put(%22message%22, %22There was an error: %22 + e);%0A                return new ModelAndView(attributes, %22error.ftl%22);%0A            %7D finally %7B%0A                if (connection != null) try%7Bconnection.close();%7D catch(SQLException e)%7B%7D%0A            %7D%0A        %7D, new FreeMarkerEngine());
 %0A    %7D%0A%0A

Add /db path