Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Scout/HowTo/3.7/Write a jdbc connection bundle

< Scout‎ | HowTo‎ | 3.7
Revision as of 02:49, 17 October 2011 by Dev.jmini.fr (Talk | contribs) (from: http://www.eclipse.org/forums/index.php/mv/msg/246503/738769/#msg_738769)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Scout documentation has been moved to https://eclipsescout.github.io/.

Note.png


Eclipse Scout is shipped with Derby support. It is possible to write an other jdbc connection bundle (In order to support other database engine).

1. create a plugin project File -> New -> Other... (or hit [Ctrl+N]) lets say 'org.eclipse.scout.rt.jdbc.microsoft'.

2. create the folder 'org.eclipse.scout.rt.jdbc.microsoft/lib' put the jdbc driver jar (lets say sqljdbc.jar) in there.

3. open 'org.eclipse.scout.rt.jdbc.microsoft/META-INF/MANIFEST.MF'. Switch to the 'Runtime' tab and add the sqljdbc.jar to the 'Classpath' box.

4. open 'org.eclipse.scout.rt.jdbc.microsoft/META-INF/MANIFEST.MF'. Switch to the 'Dependencies' tab and add 'org.eclipse.scout.rt.server' to the 'Required Plug-ins' box.

5. open 'org.eclipse.scout.rt.jdbc.microsoft/META-INF/MANIFEST.MF'. Switch to the 'MANIFEST.MF' tab and add the line: 'Eclipse-RegisterBuddy: org.eclipse.scout.rt.server' (without the ').

6. create a new class 'org.eclipse.scout.rt.jdbc.microsoft.AbstractMicrosoftSqlService' like:

public abstract class AbstractMicrosoftSqlService extends AbstractSqlService {
 
  @Override
  protected String getConfiguredJdbcDriverName() {
    return "com.microsoft.jdbc.sqlserver.SQLServerDriver";
  }
 
  @Override
  protected String getConfiguredJdbcMappingName() {
    return "jdbc:microsoft:sqlserver://<servername>:<port>";
  }
}

7. Open the '*.product' files of your server bundle. Switch to the 'Dependencies' tab and add the created plugin 'org.eclipse.scout.rt.jdbc.microsoft'. (If you do not need the derby sql service you can remove the bundle 'org.eclipse.scout.rt.jdbc.derby' from the dependencies).

8. Switch to the Scout perspective and create a new Sql Service 'server/Common Services/Sql Services'. Use 'AbstractMicrosoftSqlService' as a super type.

9. Override the 'getConfiguredJdbcMappingName' and replace <servername> and <port>. If username and password is required override the methods 'getConfiguredUsername' and 'getConfiguredPassword'.

In some case you need also to write your own SQL Style (see getConfiguredSqlStyle). For more information take a look at org.eclipse.scout.rt.jdbc.derby bundle.

Back to the top