Help Center/ GaussDB/ Developer Guide(Distributed_V2.0-10.x)/ Feature Usage Guidelines/ Database Connection Driver Guide/ JDBC/ Operation Guide/ Processing the Result Set
Updated on 2026-07-28 GMT+08:00
Processing the Result Set
After executing a query statement, you need to process the returned result set.
- Use the while loop and next() method to traverse the result set row by row.
while (rs.next()) { // Obtain values by column index. int c_customer_sk = rs.getInt(1); // Obtain int data in the first column. String c_customer_name = rs.getString(2); // Obtain string data in the second column. System.out.println("c_customer_sk: " + c_customer_sk + ", c_customer_name: " + c_customer_name); } - Call the close() method to close resources.
1 2
rs.close(); // Close the ResultSet object. stmts.close(); // Close the Statement object.
Parent topic: Operation Guide
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot