Create a SQL file and run it against a given database instance.
You must create a project to store the SQL file that you want to create and assign the Apache Derby project nature to the project. You can then create a SQL file and associate it with a connection profile. Use the SQL Editor and Content Assist to add SQL commands. After you execute the query, you can view its results and modify the query, if necessary.
- Select from the main menu bar.
The Select a Wizard dialog opens. You must create an Eclipse project to contain your SQL file.
- Select Java Project from the Wizards list box.
- Click Next.
The Create a Java Project wizard opens.
- Type a name in the Project Name
field and click Finish.
The project appears in the Navigator. Now we can add the Apache Derby project nature to the project.
- Right-click the project in the Navigator and select .
Adding the Apache Derby project nature
provides the following to your project:
- Select from the main menu bar.
The Select a Wizard dialog opens. You can now create a SQL file.
- Expand SQL Development and select SQL File.
The Create SQL File wizard opens.
- Select the Connection profile type and Connection profile name.
- Click Finish.
The SQL editor opens.
- Right-click in the editor and select Set Connection Info.
The Select Profile for the Editor dialog opens.
- Select the Connection profile type and Connection profile name and click OK.
When this connection information is set, richer content assist for table and column names is enabled in the SQL editor.
- Type the following SQL statement:
select * from SYS.SYSTABLES
-
Right-click in the editor and select Execute All.
The query results appear in the SQL Results view. The left pane displays the execution history. For each statement, including stored procedures, that you execute, an entry and Eclipse launch configuration is added. This allows you to quickly retest the execution using slightly different values and settings. You can rename or delete the launch configurations as needed.