Solved

JSP and MS Access

Posted on 2004-04-09
6
193 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
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

680 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