# JDBC escape syntax

JDBC provides a way of smoothing out some of the differences in the ways different DBMS vendors implement SQL. This is called escape syntax.

Escape syntax signals that the JDBC driver, which is provided by a particular vendor, scans for any escape syntax and converts it into the code that the particular database understands. This makes escape syntax DBMS-independent.

A JDBC escape clause begins and ends with curly braces. A keyword always follows the opening curly brace:

    { keyword }

The JDBC escape keywords are case-insensitive.

Other JDBC escape keywords are not supported.
Note: Derby returns the SQL unchanged in the Connection.nativeSQL call, since the escape syntax is native to SQL. In addition, it is unnecessary to call Statement.setEscapeProcessing for this reason.

- JDBC escape keyword for call statements
  This escape syntax is supported for a java.sql.Statement and a java.sql.PreparedStatement in addition to a CallableStatement.
- JDBC escape syntax for LIKE clauses
  The percent sign (%) and underscore (_) are metacharacters within SQL LIKE clauses. JDBC provides syntax to force these characters to be interpreted literally.
- JDBC escape syntax for limit/offset clauses
  The LIMIT escape clause can occur in a query at the point where an OFFSET/FETCH FIRST clause can appear.
- JDBC escape syntax for fn keyword
  You can specify functions in JDBC escape syntax by using the fn keyword.
- JDBC escape syntax for outer joins
  Derby interprets the JDBC escape syntax for outer joins (and all join operations) as equivalent to the correct SQL syntax for outer joins or the appropriate join operation.
- JDBC escape syntax for time formats
  Derby interprets the JDBC escape syntax for time formats as equivalent to the correct SQL syntax for times.
- JDBC escape syntax for date formats
  Derby interprets the JDBC escape syntax for date formats as equivalent to the correct SQL syntax for dates.
- JDBC escape syntax for timestamp formats
  Derby interprets the JDBC escape syntax for timestamp formats as equivalent to the correct SQL syntax for timestamps.

Parent topic: JDBC reference
Related reference
java.sql.Driver interface
java.sql.DriverManager.getConnection method
java.sql.Connection interface
java.sql.DatabaseMetaData interface
java.sql.Statement interface
java.sql.CallableStatement interface
java.sql.PreparedStatement interface
java.sql.ResultSet interface
java.sql.ResultSetMetaData interface
java.sql.SQLException class
java.sql.SQLWarning class
java.sql.SQLXML interface
java.sql.Savepoint interface
Mapping of java.sql.Types to SQL types
Features supported on JDBC 4.1 and above
JDBC 4.2-only features