Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Select Oracle table from JSP via JRUN

Posted on 2001-09-04
4
Medium Priority
?
275 Views
Last Modified: 2012-06-27
Hi all,
Let give me a sample page how to display all records of a table please.

I used Oracle 8i, JRun 3.1

Thanks
0
Comment
Question by:hieutd
[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
  • 3
4 Comments
 
LVL 19

Accepted Solution

by:
cheekycj earned 800 total points
ID: 6457182
Just put in the jdbc code to retrieve the data... like so:

DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
      // Connect to the local database
       conn = DriverManager.getConnection("jdbc:oracle:thin:@servername:portnumber:databasename","", "");

Now prepare your sql statement and execute it.

you need to import java.sql.*

if you need the full code let me know.

CJ
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6457189
here is the query part of the code:
String myQueryStr = "select * from myTable";
PreparedStatement ps = conn.prepareStatement(myQueryStr);
ResultSet rs = ps.executeQuery();

while (rs.next()) {

  // get data using rs.getString or whatever
}

CJ
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6460628
Grade C??

:-(
0
 

Author Comment

by:hieutd
ID: 6464490
OK, thankyou.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to count occurrences of each item in an array.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

704 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