Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP and ODBC  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to execute a java program from JSP, which will return a ResultSet to JSP. I am getting the Class not found error.
Part of my JSP:
<%@ page contentType="text/xml" %>
<%@ page import="java.sql.*" %>
<jsp:useBean id="dbconnectbean" scope="page" class="DBConnectBean"/>
ResultSet rs=null;
ResultSetMetaData rsmd=null;
int count;
rs=dbconnectbean.getResult(); ----> ERROR IN THIS LINE
My Java program:
import java.util.*;
import java.sql.*;
import java.text.*;
public class DBConnectBean implements Serializable {
private Connection con = null;
private String url;
private String userLogin;
private String password;
private static final String empID = "EMP1002";
public ResultSet rs = null;
private Statement stmt = null;
private PrintWriter out = null;
private String SQL;
static {
try {
} catch (Exception e) {
System.out.println("Can't get the driver");
public DBConnectBean() {
public ResultSet getResult() throws SQLException
try {
url="jdbc dbc:JSPTest";
con = DriverManager.getConnectionurl,userLogin, password);
} catch (Exception e) { e.printStackTrace(); }
try {
SQL="select * from employee_mst;
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
} catch (Exception e) { out.println ("Exception " + e ; }
return rs;
The error is:
org.apache.jasper.JasperException: Unable to compile class for JSPD:\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\ Class jsp.DBConnectBean not found.
DBConnectBean dbconnectbean = null;
Any help is appreciated.
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to import whatever package your DBConnectBean class is in.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!