1 Reply Latest reply on Nov 10, 2017 12:33 PM by smacdonald2008

    AEM 6.2 JSP Connection to a Postgres db


      I am trying to test a quick JSP connection to a postgres db. I was following a tutorial using the Felix Console and uploaded the org.postgresql.jdbc41 jar to the Day Commons JDBC Connections Pool. What I am having trouble figuring out is how exactly to use any of this to connect to the database.


      I really just need to grab a simple array of values and need the simplest implementation to get this work.


      <%@ page import = "java.sql.*" %>

      <%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %><%@ taglib prefix = "sql" uri="http://java.sun.com/jstl/sql" %>





              Connection con = DriverManager.getConnection("jdbc:postgresql:" + ip, username, pass);




             Statement statement = con.createStatement();

             ResultSet rs = stmt.executeQuery("select * from details");

             while (rs.next()) {  


            <%= rs.getString("address") %>





      I understand that I'm doing this incorrectly, but I could really use some help figuring out what I'm doing wrong.