Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP/JDBC problem  RSS feed

shishir gupta
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run my jsp in tomcat3.2.1 but getting an internal servlet error. If i am writing any JSP without doing any database related thing my jsp is running fine but when i try to get it connected to a databse it gives this error. I am using oracle8i:
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPD:\jakarta-tomcat\work\localhost_8080%2Fexamples\ Ambiguous class: java.beans.Statement and java.sql.Statement
Statement st=con.createStatement();
D:\jakarta-tomcat\work\localhost_8080%2Fexamples\ Class jsp.resultSet not found.
resultSet rs=st.executeQuery("Select ename,job,salary,deptno from EMP");
D:\jakarta-tomcat\work\localhost_8080%2Fexamples\ Variable st may not have been initialized.
3 errors
at org.apache.jasper.compiler.Compiler.compile(
at org.apache.jasper.servlet.JspServlet.doLoadJSP(
at org.apache.jasper.servlet.JasperLoader12.loadJSP(
at org.apache.jasper.servlet.JspServlet.loadJSP(
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
at org.apache.jasper.servlet.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.tomcat.core.ServletWrapper.doService(
at org.apache.tomcat.core.Handler.service(
at org.apache.tomcat.core.ServletWrapper.service(
at org.apache.tomcat.core.ContextManager.internalService(
at org.apache.tomcat.core.ContextManager.service(
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(
at org.apache.tomcat.service.TcpWorkerThread.runIt(
at org.apache.tomcat.util.ThreadPool$
at Source)
Bear Bibeault
Author and ninkuma
Posts: 66264
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks pretty clear to me, The compiler is confused between the Statement classes in the javax.sql and the java.beans packages, so you need to specifically import the one you want (assuming javax.sql).
And, this is Java which is case sensitive, you need to type ResultSet correctly.
Just basic Java errors.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!