1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Qustion about JDBC

  1. May 15, 2012 #1
    Question about JDBC

    Here is a snippet of some JDBC code I wrote, I want to know what I have to put in the while block to iterate the result, I've seen examples of JDBC code but have no idea how you choose what to put in the while block and how it helps with the final result, can anyone explain this to me ?

    My code
    Code (Text):

    ResultSet result = select.executeQuery("SELECT *, FROM Titles");

                System.out.println("Got results: ");/

                   // what do I put here ?
    Example Code :

    Code (Text):

    Statement statement = connection.createStatement();

    String sql = "select * from people";

    ResultSet result = statement.executeQuery(sql);

    while(result.next()) {

        String name = result.getString("name");
        long   age  = result.getLong("age");



    Last edited: May 16, 2012
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted