Chapter 11. Universal SQL Access

Table of Contents

Output (Results) Window
Output Formats

Universal SQL Access is a "fall-back" tool that lets you work at the raw SQL command level. This is an advanced topic and should only be used by those familiar with the intricacies of SQL commands and the details of your database.

Universal SQL Access is started from the menu entry under the Tools menu, and begins with the GUI window shown below. The first thing you should do is select which database connection you wish to use. The list of Connections is the same as the main program uses, as set up in the JDBC Connections window.

The basic steps to using Universal SQL Access are to type a command in the top (SQL Command) section of the window and click the Execute button; the results are displayed in the bottom (SQL Results) section. To save you some typing, you can just drag the databases, tables and columns shown in the DB tree at the left of the Universal SQL Access window and drop them on the top (SQL Command) section.

You can enter more than one SQL statement in the SQL Command section. If you do this, be sure to terminate each one with a semicolon. If you enter only one SQL statement, the terminating semicolon is unnecessary. The statements are not interpreted by Universal SQL Access itself, so anything that the given database and driver accepts can be used. For example, with Oracle, you can use PL/SQL statements. With most drivers you should be able to use stored procedures.

To execute your commands, use the mouse to press the execute button, or hit Ctrl-Enter (Command-Enter on Mac). Normally, all statements in the SQL Command text area will be executed in sequence. However, if there is a selection (in other words, some of the text is highlighted) when you execute, only the selected text will be executed. So if you only want to execute a subset of the commands, simply select the part you wish to execute.

By default, auto-commit is enabled, which means each SQL statement is executed in its own transaction context. Be careful, because this means the effects of your update and delete statements are not undoable! If you turn the Auto Commit off, and your database supports transactions (most do), you can manually Commit or Rollback later.

Output (Results) Window

Command Output appears in the SQL Output window. A scrollbar will appear if the information cannot all be seen at once.

Universal SQL Access keeps a log of statements executed and errors encountered. If you run an undate-type statement, or your statement is rejected by the database, the bottom half of the window will automatically switch to the "Log" tab so you can see the row count or database error message, respectively. Conversely, when you execute a select-type statement, the bottom half of the window switches to the tabular result set view so you can see the data that was selected. Note that in this case, there will still be an entry in the log tab with the date and time the query was executed, how long it took to execute, and how many rows were selected. You can see this information by manually switching to the "Log" tab.