Executing SQL Statements

SQL is the language that is used to interact with database servers. SQL statements can be used to add information to a database, update or delete existing database information, or retrieve information from a database. The purpose of the java.sql package is to allow you to execute SQL statements from Java. This section discusses the JDBC API interfaces that are used to execute SQL statements.

The Statement Interface

In the ResultApp program, you created an object of the Statement interface by invoking the createStatement() method of the Connection interface. You then invoked the executeQuery() method of the Statement interface, passing it the SELECT * FROM project SQL statement as an argument. This resulted in the database ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams 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.