am trying to connect a jsp page to a postgress database
i have created a jdbcconnects.java file and compiled it with jsp_api.jar from my apache..../lib directory
i have placed the class file in root/WEB-INF/classes folder
the code of my class file is
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Jdbcconnections {
public Connection connect()throws Exception {
Connection con = null;
try {
Class.forName ("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/EMPPWD", "postgres", "ankur");
} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());}
return con;
}
}
in the jsp page i have written
<%@ page import="Jdbcconnections" %>
Jdbcconnections obj=new Jdbcconnections();
Connection con;
con=obj.connect();