Allocating Statements

After successfully loading a driver and connecting to the database, the application can begin issuing some dynamic SQL statements.

Dynamic SQL statements are those statements that your application builds and executes at runtime. These statements are built and typically only used once. The application builds the SQL statement as a series of strings and then submits the statement for processing.

The first step in executing dynamic SQL is to allocate a statement. In other programming environments, this is sometimes referred to as getting a statement handle. This statement will be used for executing the SQL statements.

 Connection conn = null; Statement stmt = null; conn = DriverManager.getConnection("jdbc:derby:YMLD"); stmt ...

Get Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.