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();

the error is


i am getting a


An error occurred at line: 7 in the generated java file
The import Jdbcconnections cannot be resolved

An error occurred at line: 14 in the jsp file: /payroll/ddoregisters.jsp
Jdbcconnections cannot be resolved to a type
11: <%@ page import="Jdbcconnections" %>
12: <%
13:
14: Jdbcconnections obj=new Jdbcconnections();
15: Connection con;
16: con=obj.connect();
17:


An error occurred at line: 14 in the jsp file: /payroll/ddoregisters.jsp
Jdbcconnections cannot be resolved to a type
11: <%@ page import="Jdbcconnections" %>
12: <%
13:
14: Jdbcconnections obj=new Jdbcconnections();
15: Connection con;
16: con=obj.connect();
17:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.