There are two preferences that you can set to specify how
the workbench validates the SQL statements that you author in the Java™ editor.
About this task
The workbench can perform the following SQL validation:
- Validate table references
- If selected, checks whether SQL statements refer to database objects
by their correct names. The SQL statements can be in an annotation
such as @Select, or in pureQuery methods. Validation
occurs as you type SQL statements in the Java editor,
when you save the Java file,
and when you build the Java project.
- Validate SQL problems against live database
- Specify whether you want the workbench to confirm the SQL problems
that it finds by testing the SQL against the database that is associated
with your Java project. The
SQL model that the workbench uses does not support all of the SQL
extensions that are supported by all of the types of database that
your applications might connect to. However, if the workbench finds
problematic SQL in a statement that you are creating or editing, the
workbench can connect to the database to find out whether that database
supports that SQL. The workbench reports SQL problems in the Java Editor. When you build the
files in a Java project, the
workbench also reports SQL problems in the Problems view.
- If the workbench is unable to connect to the database, or if the
database throws an exception, the message for the SQL problem says
so. In such cases, the message is prefixed "SQL Problem validation
error:"
Procedure
You can enable validation for the entire workspace of
a single project.
- Follow one of these steps:
- To set preferences for your entire workspace, select . In the Preferences window, select .
- To set preferences for a single project, right-click the project
and select Properties. Then, select the pureQuery page.
- If you are setting preferences for a single project, select
the Enable project-specific settings check
box.
- Under Compilation settings, use the check boxes Validate
table references and Validate SQL problems
against live database.