When coding a Java program that will perform a SELECT statement that return multiple rows, what are the steps needed? The first is to make a connection to the database and the last is close the connection. What are the other steps?
1. Make a connection to the
database
2. Create a PrepatedStatement object
with the SQL SELECT statement
3. Set the parameters for the PrepatedStatement
object with your Java variables
4. Execute the statement using a ResultSet
object and the executeQuery() method - executeUpdate(), or execute() can be
used for other types of SQL statements.
5. Process the ResulSet.
6. Close the connection.
2. Create a PrepatedStatement object with the SQL SELECT statement
3. Set the parameters for the PrepatedStatement object with your Java variables
4. Execute the statement using a ResultSet object and the executeQuery() method - executeUpdate(), or execute() can be used for other types of SQL statements.
5. Process the ResulSet.
6. Close the connection.
No comments:
Post a Comment