please help with my connection i'm getting error("exception: org.postgresql.util.PSQLException: The connection attempt failed.The connection attempt failed.")
this is my code..

<%@ page language="java" contentType="text/html; charset=UTF-8"
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page language="java" import="java.sql.*"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>List of Employee</title>
<table border="1" cellpadding="1" cellspacing="1" align="center">
<th>Test Connection</th>
<td>Hooray! We connected to the database!</td>
<td><a href="pages/MainForm.jsp"> <html:button value="Back to Main Menu" property="back"/> </a></td>
<td><html:button value="Test Connection" property="Sample"/></td>
        try {
                Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:8080/Employee", "rtz_jhay","kudeta7");
            Statement stmt = conn.createStatement();
            ResultSet rs;

            rs = stmt.executeQuery("SELECT * FROM Empinfo");
            out.println( "<table border=1>" );
            out.println("<table border=1><tr bgcolor=yellow><th>Nr</th><th>Product</th><th>Type</th><th>Amount</th><th>Price</th></tr>");

            while ( ) {
                String a = rs.getString("id");
                String b = rs.getString("name");

                out.println("<tr><td>"+a+"</td><td>"+b+"</td></tr>" );
                out.println( "</table>" );


        } catch (ClassNotFoundException e) {
            out.println("<h1>Class not found:" + e + e.getMessage() + "</h1>" );
        } catch (Exception e) {
            out.println( "<h1>exception: "+e+e.getMessage()+"</h1>" );

This article has been dead for over six months. Start a new discussion instead.