16.10.2015 Views

Getting Startedwith pureQuery

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

72<br />

<strong>Getting</strong> Started with <strong>pureQuery</strong><br />

the Java editor when you choose <strong>pureQuery</strong> support for your project. You can use these<br />

features for applications using the <strong>pureQuery</strong> APIs and for JPA, Hibernate or JDBC<br />

applications. DB2 LUW, DB2 for z/OS, IDS, iSeries and Oracle databases are also<br />

supported. For more details on these features and many more, refer to the article at<br />

http://www.ibm.com/developerworks/data/library/techarticle/dm-0709surange/<br />

3.3.1 SQL validation within the Java editor<br />

Java developers often write applications that contain complex SQL and you as a Java<br />

developer may not be an expert in writing the SQL queries you need. It is also sometimes<br />

difficult to remember the exact table or column names. You must either refer to some<br />

complex schema drawing or DDL, or you may mistype the column name in your SQL<br />

statement. The Java editor reports SQL errors while you type SQL statements, and shows<br />

them in the same way that Java language errors are shown. Figure 3.6 shows an example<br />

SQL statement with a column name misspelled, missing the letter R. Errors in SQL<br />

keywords (syntactic) and schema, table, column or other database names (semantic)<br />

errors are detected.<br />

Figure 3.6 - SQL errors are flagged while typing in the Java editor<br />

3.3.2 SQL semantic and syntactic content assist for SQL inside Java editor<br />

The Java editor provides SQL content-assits and validates syntax by using live database<br />

connection settings. To get SQL content assist inside the Java editor, press (Ctrl +<br />

Spacebar) the Crtl key and spacebar (or your default content assist keystroke) to popup<br />

the content-assit window, as shown in Figure 3.7. The content-assist popup window helps<br />

you:<br />

• Discover and select SQL keywords<br />

• Discover and select from the list of table and column names<br />

• Use content-assist proposals to see database types and primary keys

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!