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

JSP/JDBC problem  RSS feed

 
shishir gupta
Greenhorn
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\_0002fjsp_0002fSimplejdbc_0002ejspSimplejdbc_jsp_0.java:79: Ambiguous class: java.beans.Statement and java.sql.Statement
Statement st=con.createStatement();
^
D:\jakarta-tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fSimplejdbc_0002ejspSimplejdbc_jsp_0.java:80: Class jsp.resultSet not found.
resultSet rs=st.executeQuery("Select ename,job,salary,deptno from EMP");
^
D:\jakarta-tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fSimplejdbc_0002ejspSimplejdbc_jsp_0.java:114: Variable st may not have been initialized.
st.close();
^
3 errors
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:440)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:411)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:152)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:164)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:296)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:368)
at org.apache.tomcat.core.Handler.service(Handler.java:261)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:356)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:720)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:666)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:194)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:403)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Unknown Source)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66264
151
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!