Solved

JSP and MS Access

Posted on 2004-04-09
6
178 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:mayankeagle
ID: 10791627
The package is java.sql, not jdbc.sql. Replace jdbc.sql with java.sql
0
 
LVL 30

Accepted Solution

by:
mayankeagle 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:mayankeagle
ID: 10791652
Same goes for ResultSet, etc.
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10971031
Please proceed with that recommendation.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
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.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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 …

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now