O'Reilly logo

Special Edition Using Java 2 Standard Edition by Geoff Friesen, Chuck Cavaness, Brian Keeton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required