Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Eclipse/Oracle Problems I am trying to follow a youtube guide and ran into an error. I can not get the oracle table to pop up

Eclipse/Oracle Problems

I am trying to follow a youtube guide and ran into an error. I can not get the oracle table to pop up under the header.

I am also recieving errors in my .jsp that I am unsure how to fix.

I am using localhost, hr/hr, and oracle 11g with jdbc6 in the lib.

Please show me how and where to fix the code or direct me in how to set this up. Will upvote!

---------------------------------------------------

Here is my code:

listCustomers.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

List of Participating Customers

<%@ include file="header.html"%>

List of Participating Customers

select * from customer

order by cus_num

Number First Name Last Name Email Phone
${row.cus_num} ${row.cus_fname} ${row.cus_lname} ${row.cus_email} ${row.cus_phone}

[Edit]

[Delete]

--------------------------------------------------------------

DatabaseListener.java

package listeners;

import javax.servlet.ServletContext;

import javax.servlet.ServletContextEvent;

import javax.servlet.ServletContextListener;

import javax.servlet.annotation.WebListener;

import oracle.jdbc.pool.OracleDataSource;

@WebListener

public class DatabaseListener implements ServletContextListener {

public void contextDestroyed(ServletContextEvent arg0) {

}

public void contextInitialized(ServletContextEvent sce) {

ServletContext ctx = sce.getServletContext();

try {

OracleDataSource ods = new OracleDataSource();

ods.setUser("hr");

ods.setPassword("hr");

ods.setURL("jdbc:oracle:thin:@localhost:1521/xe");

ctx.setAttribute("oracleDataSource", ods);

System.out.println("Created OracleDataSource successfully!");

} catch(Exception ex) {

System.out.println("Error : " + ex.getMessage());

}

}

}

------------------------------------------------------------------------------

customer.sql

CREATE TABLE customer (

cus_num NUMBER(12) NOT NULL,

cus_fname VARCHAR(255) NOT NULL,

cus_lname VARCHAR(255) NOT NULL,

cus_email VARCHAR(255) NOT NULL,

cus_phone CHAR(12) NOT NULL,

CONSTRAINT customer_cus_num_pk PRIMARY KEY (cus_num)

);

INSERT INTO customer Values(101, 'John', 'Smith', 'Smith123@gmai.com', '951-845-0778');

INSERT INTO customer Values(102, 'Jane', 'Doe', 'Doe123@aol.com', '678-247-7551');

INSERT INTO customer Values(103, 'Timothy', 'Haworth', 'TimothyKHaworth@rhyta.com', '864-655-1947');

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

fscanf retums a special value EOF that stands for...

Answered: 1 week ago

Question

What does the start( ) method defined by Thread do?

Answered: 1 week ago