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.
Scout/HowTo/3.7/Write a jdbc connection bundle
The Scout documentation has been moved to https://eclipsescout.github.io/.
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.