Reading Data Using JDBC
As you saw in the previous example, a Connection represents a session to a database. When it becomes necessary to read data from the database, the instance of the Connection is used, but indirectly. The main class that is used in conjunction with the Connection class is the java.sql.Statement class.
The Statement Class
The Statement class is used to execute static SQL statements and possibly read the results that were returned by the query. As the name implies, the Statement class represents a single SQL statement that needs to be executed against the database. You don't create a new instance of the Statement class directly. You use the instance of the connection as sort of a Statement Factory. You do this by calling the ...
Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.