Getting Rows from a Database Table

A SQL SELECT query is used to get data from a table. The results of the select query is called a result set. This example executes a SQL SELECT query and creates a result set. See also Getting Data from a Result Set.
try { // Create a result set containing all data from my_table Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM my_table"); } catch (SQLException e) { }

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.