%@ page language="java" import="java.sql.*"%>
<%
try
{
Class.forName("org.postgresql.Driver");
}
catch(java.lang.ClassNotFoundException e)
{
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try
{
// Replace , , below with your actual DB, user, and password.
Connection conn = DriverManager.getConnection ("jdbc:postgresql://localhost/","","");
Statement stmt = conn.createStatement();
ResultSet rs;
rs = stmt.executeQuery("select * FROM testschema.testtable");
out.println( "" );
while ( rs.next() ) {
String id = rs.getString("test_id");
String name = rs.getString("test_name");
String email = rs.getString("test_email");
out.println(""+id+" | "+name+" | "+email+" | "+" |
" );
}
out.println( "
" );
conn.close();
}
catch (Exception e)
{
out.println( "Exception: "+e+e.getMessage() );
}
%>