Solved

JSP and MS Access

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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
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.
The viewer will learn how to implement Singleton Design Pattern in Java.

856 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