Solved

Select Oracle table from JSP via JRUN

Posted on 2001-09-04
4
267 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

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

Suggested Solutions

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

770 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