Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Scout/Tutorial/3.8/Add JDBC Drivers for Eclipse Scout

< Scout‎ | Tutorial‎ | 3.8

The Scout documentation has been moved to


Scout ships with one JDBC driver for the Derby database. If you want to use other databases you can add JDBC drivers for those by installing the corresponding driver. Drivers for Oracle, Postgres and MySQL are published in the Eclipse Marketplace. This tutorial explains how to add JDBC drivers and create a SqlService using the Scout SDK.


First we create a new Scout "Hello World" application as described in the Hello World tutorial.

Installation of JDBC Drivers using Scout SDK

In the 'Scout Explorer' view select the project node and expand the corresponding 'Technologies' section in the 'Scout Object Properties' view (if not already expanded) [1]. In this section there is a group named 'Database Drivers' with a checkbox for each JDBC driver that is available. All drivers that are checked, will be available to the selected Scout project. By default a new Scout project has the Derby JDBC driver active.

For this tutorial we will use a Postgres driver instead. But the steps are the same for the other drivers as well.

First, uncheck the box named 'Derby JDBC Driver for Eclipse Scout'. A popup dialog appears listing all resources that can be modified. Ensure all checkboxes are ticked and confirm with the OK button [2]. Now, the Derby driver is no longer part of the Scout project.

Then we check the box named 'Postgres 9 JDBC Driver for Eclipse Scout'. Again: ensure all boxes are checked in the popup dialog and confirm with OK. If this is the first time you are using the Postgres driver for the running Eclipse, it will be downloaded from the Eclipse Marketplace and installed in your Eclipse instance. In that case another popup dialog apears allowing you to read and accept the license of the driver [3]. As soon as the license has been accepted the download starts (this may take a while). When the download has been completed successfully, confirm the security warning [4] with OK and choose to restart Eclipse on the next popup box.

The JDBC driver is now installed in your Eclipse instance and the helloworld project is configured to have the driver available.

Creating a SQL Service

To make use of the new driver we create a new SQL Service. For this go to 'Server' |'Common Services' | 'Sql Services', righ click and choose 'New Sql Service...' [5]. In the wizard type 'Postgres9' in the class name, choose 'AbstractPostgresSqlService' as super class [6] and press 'Finish'.

Select the new created SQL service in the 'Scout Explorer' and configure the properties 'Username', 'Password' and 'Jdbc Mapping Name' according to the setup of your database.

The SQL service is now created and ready to be used.

Accessing data on the database

Now we will access the database for our simple helloworld project. For this go to 'Server' | 'Process Services' | 'DesktopProcessService' | 'load' and double click on the 'load' operation. Implement the method as follows:

  1. public DesktopFormData load(DesktopFormData formData) throws ProcessingException {
  2.   SQL.selectInto("SELECT 'Hello World!' INTO :message", formData);
  3.   return formData;
  4. }
Some database system require a FROM clause in the SQL statement. For these use 'SELECT 'Hello World!' FROM dual INTO :message' as statement.

Start the application as described in the Hello World tutorial.

See Also

If the desired JDBC driver is not yet available, follow The Scout documentation has been moved to to learn how to create your own driver bundle.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.