New Reply

Qustion about JDBC

 
Share Thread Thread Tools
May15-12, 05:45 PM   #1
 

Qustion 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:
ResultSet result = select.executeQuery("SELECT *, FROM Titles");

            System.out.println("Got results: ");/
            
            
            while(result.next()){

               // what do I put here ?
                }
Example Code :

Code:
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");

    System.out.println(name);
    System.out.println(age);
}

result.close();
statement.close();
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Front-row seats to climate change
>> Attacking MRSA with metals from antibacterial clays
>> New formula invented for microscope viewing, substitutes for federally controlled drug
New Reply
Thread Tools


Similar Threads for: Qustion about JDBC
Thread Forum Replies
Qustion on sinewave Precalculus Mathematics Homework 4
Gravity Qustion Classical Physics 18
ideal gas law qustion? Advanced Physics Homework 2
[java]MySQL JDBC driver Programming & Comp Sci 4
Choose the right JDBC driver for your database interface Computing & Technology 0