O'Reilly logo

Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ by Dan Scott, George Baklarz, Paul C. Zikopoulos

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

Executing Dynamic SQL

SQL statements can be submitted to the database for execution. The simplest form of SQL statement to handle within an application is a Data Manipulation Language (DML) statement, such as INSERT, UPDATE, or DELETE. Such statements return no rows from the database. With DML, the program is either creating or operating on an object. An SQLException will be raised if there is an error in executing the statement.

The following code fragment will issue a SET SCHEMA statement to the database for execution:

Connection conn = null;
Statement stmt = null;

try {
  conn = DriverManager.getConnection("jdbc:derby:YMLD"); 
  stmt = conn.createStatement(); 
  stmt.execute("set schema 'APP'");  
}

The stmt.execute method will immediately execute ...

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