Solved

JSP and MS Access

Posted on 2004-04-09
6
195 Views
Last Modified: 2013-11-24
Hi
I have a jsp code that doesnt seem to work can u help please?Also is there any good tutorial website on how to add code to an ms access d/b?

The code is:

<%
  Class.forName("com.sun.jdbc.odbc.Driver");
  jdbc.sql.Connection connection = jdbc.sql.DriverManager.getConnection("jdbc:odbc:DSNEntry:C:/Documents and Settings/DJ/My Documents/database_turorials/guestbook_example/guestbook");
  jdbc.sql.Statement statement = connection.createStatement();
  jdbc.sql.ResultSet columns = statement.executeQuery("SELECT * FROM tblComments");
  while(columns.next()) {
    String id_no  = columns.getString("ID_no");
    String name = columns.getString("Name");
    String comments = columns.getString("Comments"); %>
      <TR>  <TD> <%= id_no  %> </TD>
            <TD> <%= name %> </TD>
            <TD> <%= comments %> </TD>
      </TR>
<% } %>

The errors i get is:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 9 in the jsp file: /phonebook.jsp

Generated servlet error:
    [javac] Compiling 1 source file

C:\Tomcat 4.1\work\Standalone\localhost\_\phonebook_jsp.java:60: package jdbc.sql does not exist



An error occurred at line: 9 in the jsp file: /phonebook.jsp

Generated servlet error:
  jdbc.sql.Connection connection = jdbc.sql.DriverManager.getConnection("jdbc:odbc:C:/Documents and Settings/DJ/My Documents/database_turorials/guestbook_example/guestbook");
          ^



An error occurred at line: 9 in the jsp file: /phonebook.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\phonebook_jsp.java:60: package jdbc.sql does not exist



An error occurred at line: 9 in the jsp file: /phonebook.jsp

Generated servlet error:
  jdbc.sql.Connection connection = jdbc.sql.DriverManager.getConnection("jdbc:odbc:C:/Documents and Settings/DJ/My Documents/database_turorials/guestbook_example/guestbook");
                                           ^



An error occurred at line: 9 in the jsp file: /phonebook.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\phonebook_jsp.java:61: package jdbc.sql does not exist
  jdbc.sql.Statement statement = connection.createStatement();
          ^



An error occurred at line: 9 in the jsp file: /phonebook.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\_\phonebook_jsp.java:62: package jdbc.sql does not exist
  jdbc.sql.ResultSet columns = statement.executeQuery("SELECT * FROM tblComments");
          ^
4 errors
0
Comment
Question by:djsingh81
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 10791627
The package is java.sql, not jdbc.sql. Replace jdbc.sql with java.sql
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 50 total points
ID: 10791650
You can also use @page import = "java.sql.*" and use Connection, Statement directly instead of using java.sql.Connection and java.sql.Statement everywhere.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10791652
Same goes for ResultSet, etc.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10971031
Please proceed with that recommendation.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question