Joined: 04 Dec 2002 Posts: 0 Location: Southern California, United States of America
Posted: Wed Dec 04, 2002 5:16 am Post subject: JSP to Access Connection Using Tomcat?
I'm having a slight problem with connecting my JSP code, with out the use of servlets or beans, to an Access database. I am using Tomcat 4.1 Standalone on windows 2k Professional sp3. I have set up a DSN in windows odbc named "test". And have also Set up a JNDI through the tomcat gui interface named "test2"...both pointing to the same database. Although i am not sure if the tomcat one is using correct drivers..might be the problem...
Heres the Jsp code which i have refernced from a few books and websites
Code:
<html>
<body>
<%@ page language="java" import="java.io.*,java.sql.*,java.util.*, java.lang.*, javax.sql.*" %>
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); <!--// Complies this with out error //-->
<% String url = "jdbc:odbc:test"; %>
<% Connection con = DriverManager.getConnection(url); %> <!--//Attempt number 1 //-->
<br>
Connection dbCon=DriverManager.getConnection("jdbc:odbc:test"); <!--//Attempt number 2 //-->
<br>
Connection dbCon = DriverManager.getConnection("jdbc:odbc:[odbc test]");<!--//Attempt number 3 //-->
<%
String hi="Hellow World";
out.println(hi);
%>
</body>
</html>
using any of those I get the error same errors. Now the I think its Tomcat that I am having difficulties with. Possibly the drivers for a access database..or somthing...not sure.
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\Apoc\testforum_jsp.java:43: cannot resolve symbol
symbol : class Connection
location: class org.apache.jsp.testforum_jsp
Connection myConn;
^
An error occurred at line: 1 in the jsp file: /Apoc/testforum.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\Apoc\testforum_jsp.java:51: cannot resolve symbol
symbol : variable DriverManager
location: class org.apache.jsp.testforum_jsp
myConn = DriverManager.getConnection (dbUrl, user, pass);
^
An error occurred at line: 1 in the jsp file: /Apoc/testforum.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\Apoc\testforum_jsp.java:52: cannot resolve symbol
symbol : class Statement
location: class org.apache.jsp.testforum_jsp
Statement myStmt = myConn.createStatement();
^
An error occurred at line: 13 in the jsp file: /Apoc/testforum.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\Apoc\testforum_jsp.java:53: cannot resolve symbol
symbol : class ResultSet
location: class org.apache.jsp.testforum_jsp
ResultSet myRs = myStmt.executeQuery("SELECT * FROM tblName");
^
4 errors
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:313)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:324)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Unknown Source)
your 4 errors are all "cannot resolve symbol"
and they are all indicated at the start of a line
it might be something fundamental you are doing wrong.
I suggest reading all the messages in google groups for "cannot resolve symbol" until you find one that has a explanation that might apply to your case.
what i know about jsp and tomcat could be written on the ripped off corner of a postage stamp but I can tell you how i find solutions when i have problem programming.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum