Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

Select Oracle table from JSP via JRUN

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
hieutd
Asked:
hieutd
  • 3
1 Solution
 
cheekycjCommented:
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
 
cheekycjCommented:
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
 
cheekycjCommented:
Grade C??

:-(
0
 
hieutdAuthor Commented:
OK, thankyou.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now