%@page contentType="text/html"%>
<%@page import = "java.sql.*" %>
JSP Page
<%
Connection conexion;
String cSQL = "";
ResultSet rs = null;
String Fecha = "";
try{
Class.forName("org.postgresql.Driver");
conexion = DriverManager.getConnection("jdbc:postgresql://192.168.20.37:5432/dbtis", "system", "alfa");
System.out.println("me conecte");
cSQL = "select tmp from dbtest.tmp ";
PreparedStatement stmt = conexion.prepareStatement(cSQL);
rs = stmt.executeQuery();
while (rs.next()) {
Fecha = rs.getString("tmp");
System.out.println(rs.getString("tmp"));
%>
La fecha es <%=Fecha%>
<%
}
conexion.close();
if(rs != null)
rs.close();
stmt.close();
stmt = null;
}
catch(Exception e){
System.out.println("No Conexion");
e.printStackTrace();
}
%>