Solved

Select Oracle table from JSP via JRUN

Posted on 2001-09-04
4
270 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
  • 3
4 Comments
 
LVL 19

Accepted Solution

by:
cheekycj earned 200 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

685 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