%@ page import="java.sql.*" %> <% Connection con = null; String driver = "org.postgresql.Driver"; String url = "jdbc:postgresql://localhost/testdb"; String username = "testuser"; String password = "testuser"; %>
Connection: <%=(con == null) ? "Error" : "Ok" %>
<%
Statement s = con.createStatement();
ResultSet r;
r = s.executeQuery("select count(*) from actors;");
r.next();
out.println("There are " + r.getString(1) + " tuples in actors table.
");
r = s.executeQuery("select count(*) from films;");
r.next();
out.println("There are " + r.getString(1) + " tuples in films table.
");
r = s.executeQuery("select count(*) from casts;");
r.next();
out.println("There are " + r.getString(1) + " tuples in casts table.
");
%>