Solved

Select Oracle table from JSP via JRUN

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now