?
Solved

JSP and MS Access

Posted on 2004-04-09
6
Medium Priority
?
197 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 200 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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 …
Introduction to Processes

800 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