Executing SQL Statements

Now we are at the point where we can start issuing SQL commands to our database and getting back results. We do this through a Statement object that we get from the connection object described in the previous section. Table 24-4 shows several methods in Connection.

Table 24-4. Some methods of java.sql.Connection

Method

Purpose

Statement createStatement()

Returns a statement object that is used to send SQL to the database.

PreparedStatement prepareStatement(String sql)

Returns an object that can be used for sending parameterized SQL statements.

CallableStatement prepareCall(String sql)

Returns an object that can be used for calling stored procedures.

DataBaseMetaData getMetaData()

Gets an ...

Get Just Java™ 2 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.