Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old October 19th, 2002, 04:48 PM
progkcp progkcp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 8 progkcp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to progkcp
getting data from an oracle db

I searched this forum and came up with some code that I'm trying to make work for me.

I'm running oracle 8 1 7 with 9ias.

I'm trying to just drop this in a jsp and run it from htdocs. Do I need to make sure that there are some drivers downloaded onto my machine or something along those lines?

Here's my error:

Request URI:/test2.jsp



Exception:
oracle.jsp.provider.JspCompileException: Errors compiling:c:\oracle\ora9ias\apache\apache\htdocs\_pages\\_test2.javac:\oracle\ora9ias\apache\apache\ htdocs\_pages\_test2.java:93: '}' expected.
}
^
c:\oracle\ora9ias\apache\apache\htdocs\_pages\_test2.java:94: 'try' without 'catch' or 'finally'.
private static class __jsp_StaticText {
^
c:\oracle\ora9ias\apache\apache\htdocs\_pages\_test2.java:94: Statement expected.
private static class __jsp_StaticText {
^
3 errors

Here's my jsp.




<%@ page import="java.sql.*" %>
<HTML>
<HEAD><TITLE>Simple Oracle Example</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<B>Employees</B>
<BR><BR>

<%
Connection conn = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");

conn = DriverManager.getConnection(
"jdbcracle:thin:@HOST:PORT:SID",
"scott",
"tiger");

Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM Example.Emp");

//Print start of table and column headers
out.println("<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
out.println("<TR><TH>ID</TH><TH>NAME</TH></TR>");

//Loop through results of query.
while(rs.next())
{
out.println("<TR>");
out.println("<TD>" + rs.getString("EmpID") + "</TD>");
out.println("<TD>" + rs.getString("Name") + "</TD>");
out.println("</TR>");
}

out.println("</TABLE>");
}
catch(SQLException e)
{
out.println("SQLException: " + e.getMessage() + "<BR>");
while((e = e.getNextException()) != null)
out.println(e.getMessage() + "<BR>");
}
catch(ClassNotFoundException e)
{
out.println("ClassNotFoundException: " + e.getMessage() + "<BR>");
}
finally
{
//Clean up resources, close the connection.
if(conn != null)
{
try
{
conn.close();
}
catch (Exception ignored) {}
}
}
%>

</CENTER>
</BODY>
</HTML>

Reply With Quote
  #2  
Old October 20th, 2002, 02:17 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
It looks like one too many {'s, but damned if I can find one.

Can you find the servlet that oracle generated from your jsp? Then you could actually look at line 93 and see what it was complaining about.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > getting data from an oracle db


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway