https://wiki.eclipse.org/index.php?title=Scout/HowTo/3.8/Write_a_jdbc_connection_bundle&feed=atom&action=historyScout/HowTo/3.8/Write a jdbc connection bundle - Revision history2024-03-29T07:53:13ZRevision history for this page on the wikiMediaWiki 1.26.4https://wiki.eclipse.org/index.php?title=Scout/HowTo/3.8/Write_a_jdbc_connection_bundle&diff=301336&oldid=prevMvi.bsi-software.com at 15:05, 7 May 20122012-05-07T15:05:55Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 15:05, 7 May 2012</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l70" >Line 70:</td>
<td colspan="2" class="diff-lineno">Line 70:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   @Override</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   @Override</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   protected Class<? extends ISqlStyle> getConfiguredSqlStyle() {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   protected Class<? extends ISqlStyle> getConfiguredSqlStyle() {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>     return org.eclipse.scout.rt.jdbc.<del class="diffchange diffchange-inline">microsoft</del>.MicrosoftSqlStyle.class;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>     return org.eclipse.scout.rt.jdbc.<ins class="diffchange diffchange-inline">mssql2008</ins>.MicrosoftSqlStyle.class;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Mvi.bsi-software.comhttps://wiki.eclipse.org/index.php?title=Scout/HowTo/3.8/Write_a_jdbc_connection_bundle&diff=301335&oldid=prevMvi.bsi-software.com at 15:04, 7 May 20122012-05-07T15:04:53Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 15:04, 7 May 2012</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{{ScoutPage|cat=HowTo 3.8}}</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{{ScoutPage|cat=HowTo 3.8}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Eclipse Scout is shipped with support for the [http://db.apache.org/derby/ Apache Derby] database. When creating a {{ScoutLink|Concepts|Sql Service|Sql Service}} (<del class="diffchange diffchange-inline">''See </del>the {{ScoutLink|Tutorial|Minicrm/Set_up_SQL_Service|Set up a SQL service step of the minicrm tutorial}}<del class="diffchange diffchange-inline">''</del>), you need to define the JDBC driver name as well as the JDBC mapping name. To be able to actually connect to the database you need to include a bundle providing the JDBC driver in your project definition.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Eclipse Scout is shipped with support for the [http://db.apache.org/derby/ Apache Derby] database. When creating a {{ScoutLink|Concepts|Sql Service|Sql Service}} (<ins class="diffchange diffchange-inline">compare </ins>the {{ScoutLink|Tutorial<ins class="diffchange diffchange-inline">/3.8</ins>|Minicrm/Set_up_SQL_Service|Set up a SQL service step of the minicrm tutorial}}), you need to define the JDBC driver name as well as the JDBC mapping name. To be able to actually connect to the database you need to include a bundle providing the JDBC driver in your project definition.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Bundle <code>org.eclipse.scout.rt.jdbc.derby</code> provides the JDBC driver for Derby (derby.jar) and derby-specific subclasses of <code>AbstractSqlService</code> and <code>AbstractSqlStyle</code> (the derby specific {{ScoutLink|Concepts|SqlStyle|Sql Style}}).</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Bundle <code>org.eclipse.scout.rt.jdbc.derby</code> provides the JDBC driver for Derby (derby.jar) and derby-specific subclasses of <code>AbstractSqlService</code> and <code>AbstractSqlStyle</code> (the derby specific {{ScoutLink|Concepts|SqlStyle|Sql Style}}).</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>JDBC drivers for other database engines are available at the [http://marketplace.eclipse.org/content/jdbc-drivers-eclipse-scout Eclipse Marketplace], ready to be included in your Eclipse Scout projects.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>JDBC drivers for other database engines are available at the [http://marketplace.eclipse.org/content/jdbc-drivers-eclipse-scout Eclipse Marketplace], ready to be included in your Eclipse Scout projects <ins class="diffchange diffchange-inline">(see the {{ScoutLink|Tutorial/3.8|Add_JDBC_Drivers_for_Eclipse_Scout|Add JDBC Drivers for Eclipse Scout tutorial}})</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>It is also possible to create your own JDBC connection bundles (in order to support <del class="diffchange diffchange-inline">yet </del>other database engines<del class="diffchange diffchange-inline">, </del>or if the specific version of the required driver is not provided by the <del class="diffchange diffchange-inline">above </del>sources).</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>It is also possible to create your own JDBC connection bundles (in order to support other database engines or if the specific version of the required driver is not provided by the sources <ins class="diffchange diffchange-inline">above</ins>).</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>You can</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>You can</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l27" >Line 27:</td>
<td colspan="2" class="diff-lineno">Line 27:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>## Set a Provider (or keep empty)</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>## Set a Provider (or keep empty)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div># Fill the 'Host Plug-in' section</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div># Fill the 'Host Plug-in' section</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>## Set Plug-in ID to <del class="diffchange diffchange-inline">org</del>.<del class="diffchange diffchange-inline">eclipse.scout.rt.server </del>(this is important!)</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>## Set Plug-in ID to <ins class="diffchange diffchange-inline"><code>system</ins>.<ins class="diffchange diffchange-inline">bundle</code> </ins>(this is important!)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>## Minimum and maximum version can be left empty</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>## Minimum and maximum version can be left empty</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div># Finish the wizard. A new fragment project is created in your workspace (it should contain a folder META-INF with the MANIFEST.MF file and also a build.properties file)</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div># Finish the wizard. A new fragment project is created in your workspace (it should contain a folder META-INF with the MANIFEST.MF file and also a build.properties file)</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l54" >Line 54:</td>
<td colspan="2" class="diff-lineno">Line 54:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 1. Download the current MS SQL Server JDBC driver (say sqljdbc.jar)</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 1. Download the current MS SQL Server JDBC driver (say sqljdbc.jar)</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* 2. Create a plugin project: File -> New -> Other... (or hit [Ctrl+N]) lets say 'org.eclipse.scout.rt.jdbc.<del class="diffchange diffchange-inline">microsoft</del>'.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* 2. Create a plugin project: File -> New -> Other... (or hit [Ctrl+N]) lets say 'org.eclipse.scout.rt.jdbc.<ins class="diffchange diffchange-inline">mssql2008</ins>'.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 3. Create the folder 'lib' and put the JDBC driver jar into the folder.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 3. Create the folder 'lib' and put the JDBC driver jar into the folder.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 4. Open the file 'META-INF/MANIFEST.MF', the manifest editor opens.  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 4. Open the file 'META-INF/MANIFEST.MF', the manifest editor opens.  </div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l63" >Line 63:</td>
<td colspan="2" class="diff-lineno">Line 63:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Eclipse-RegisterBuddy: org.eclipse.scout.rt.server</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Eclipse-RegisterBuddy: org.eclipse.scout.rt.server</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* 8. Create a new class <code>org.eclipse.scout.rt.jdbc.<del class="diffchange diffchange-inline">microsoft</del>.AbstractMicrosoftSqlService</code> (the {{ScoutLink|Concepts|Sql Service|<del class="diffchange diffchange-inline">sql service</del>}}):</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* 8. Create a new class <code>org.eclipse.scout.rt.jdbc.<ins class="diffchange diffchange-inline">mssql2008</ins>.AbstractMicrosoftSqlService</code> (the {{ScoutLink|Concepts|Sql Service|<ins class="diffchange diffchange-inline">SQL Service</ins>}}):</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><source lang="java"></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><source lang="java"></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l84" >Line 84:</td>
<td colspan="2" class="diff-lineno">Line 84:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>}</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* 9. Create a new class <code>org.eclipse.scout.rt.jdbc.<del class="diffchange diffchange-inline">microsoft</del>.MicrosoftSqlStyle</code> (the {{ScoutLink|Concepts|SqlStyle|<del class="diffchange diffchange-inline">sql style</del>}}):</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* 9. Create a new class <code>org.eclipse.scout.rt.jdbc.<ins class="diffchange diffchange-inline">mssql2008</ins>.MicrosoftSqlStyle</code> (the {{ScoutLink|Concepts|SqlStyle|<ins class="diffchange diffchange-inline">SQL Style</ins>}}):</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><source lang="java"></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><source lang="java"></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l148" >Line 148:</td>
<td colspan="2" class="diff-lineno">Line 148:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 10. Open the manifest editor again. Switch to the 'Runtime' tab. Add the package which contains the two created classes to the exported packages.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 10. Open the manifest editor again. Switch to the 'Runtime' tab. Add the package which contains the two created classes to the exported packages.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* 11. Open the '*.product' files of your server bundle. Switch to the 'Dependencies' tab and add the created plugin <code>org.eclipse.scout.rt.jdbc.<del class="diffchange diffchange-inline">microsoft</del></code>. (If you do not need the derby sql service you can remove the bundle <code>org.eclipse.scout.rt.jdbc.derby</code> from the dependencies).</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* 11. Open the '*.product' files of your server bundle. Switch to the 'Dependencies' tab and add the created plugin <code>org.eclipse.scout.rt.jdbc.<ins class="diffchange diffchange-inline">mssql2008</ins></code>. (If you do not need the derby sql service you can remove the bundle <code>org.eclipse.scout.rt.jdbc.derby</code> from the dependencies).</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 12. Switch to the Scout perspective and create a new <code>SqlService</code>: server/Common Services/Sql Services. Use <code>AbstractMicrosoftSqlService</code> as a super type.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 12. Switch to the Scout perspective and create a new <code>SqlService</code>: server/Common Services/Sql Services. Use <code>AbstractMicrosoftSqlService</code> as a super type.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 13. Override the <code>getConfiguredJdbcMappingName</code> method and replace <servername> and <port>. If username and password are required, override the methods <code>getConfiguredUsername</code> and <code>getConfiguredPassword</code>.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* 13. Override the <code>getConfiguredJdbcMappingName</code> method and replace <servername> and <port>. If username and password are required, override the methods <code>getConfiguredUsername</code> and <code>getConfiguredPassword</code>.</div></td></tr>
</table>Mvi.bsi-software.comhttps://wiki.eclipse.org/index.php?title=Scout/HowTo/3.8/Write_a_jdbc_connection_bundle&diff=300978&oldid=prevMvi.bsi-software.com at 09:35, 4 May 20122012-05-04T09:35:40Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 09:35, 4 May 2012</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>{{ScoutPage|cat=HowTo 3.<del class="diffchange diffchange-inline">7</del>}}</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>{{ScoutPage|cat=HowTo 3.<ins class="diffchange diffchange-inline">8</ins>}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Eclipse Scout is shipped with support for the [http://db.apache.org/derby/ Apache Derby] database. When creating a {{ScoutLink|Concepts|Sql Service|Sql Service}} (''See the {{ScoutLink|Tutorial|Minicrm/Set_up_SQL_Service|Set up a SQL service step of the minicrm tutorial}}''), you need to define the JDBC driver name as well as the JDBC mapping name. To be able to actually connect to the database you need to include a bundle providing the JDBC driver in your project definition.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Eclipse Scout is shipped with support for the [http://db.apache.org/derby/ Apache Derby] database. When creating a {{ScoutLink|Concepts|Sql Service|Sql Service}} (''See the {{ScoutLink|Tutorial|Minicrm/Set_up_SQL_Service|Set up a SQL service step of the minicrm tutorial}}''), you need to define the JDBC driver name as well as the JDBC mapping name. To be able to actually connect to the database you need to include a bundle providing the JDBC driver in your project definition.</div></td></tr>
</table>Mvi.bsi-software.comhttps://wiki.eclipse.org/index.php?title=Scout/HowTo/3.8/Write_a_jdbc_connection_bundle&diff=300977&oldid=prevMvi.bsi-software.com: New page: {{ScoutPage|cat=HowTo 3.7}} Eclipse Scout is shipped with support for the [http://db.apache.org/derby/ Apache Derby] database. When creating a {{ScoutLink|Concepts|Sql Service|Sql Service...2012-05-04T09:35:30Z<p>New page: {{ScoutPage|cat=HowTo 3.7}} Eclipse Scout is shipped with support for the [http://db.apache.org/derby/ Apache Derby] database. When creating a {{ScoutLink|Concepts|Sql Service|Sql Service...</p>
<p><b>New page</b></p><div>{{ScoutPage|cat=HowTo 3.7}}<br />
<br />
Eclipse Scout is shipped with support for the [http://db.apache.org/derby/ Apache Derby] database. When creating a {{ScoutLink|Concepts|Sql Service|Sql Service}} (''See the {{ScoutLink|Tutorial|Minicrm/Set_up_SQL_Service|Set up a SQL service step of the minicrm tutorial}}''), you need to define the JDBC driver name as well as the JDBC mapping name. To be able to actually connect to the database you need to include a bundle providing the JDBC driver in your project definition.<br />
Bundle <code>org.eclipse.scout.rt.jdbc.derby</code> provides the JDBC driver for Derby (derby.jar) and derby-specific subclasses of <code>AbstractSqlService</code> and <code>AbstractSqlStyle</code> (the derby specific {{ScoutLink|Concepts|SqlStyle|Sql Style}}).<br />
<br />
JDBC drivers for other database engines are available at the [http://marketplace.eclipse.org/content/jdbc-drivers-eclipse-scout Eclipse Marketplace], ready to be included in your Eclipse Scout projects.<br />
<br />
It is also possible to create your own JDBC connection bundles (in order to support yet other database engines, or if the specific version of the required driver is not provided by the above sources).<br />
<br />
You can<br />
* create a ''fragment bundle'' providing the JDBC connector library directly to the host bundle <code>org.eclipse.scout.rt.server</code><br />
* create a normal ''bundle'' containing the JDBC connector library as well as additional sources which you like to export to other bundles.<br />
<br />
Choose the second option if you need specific implementations of <code>AbstractSqlService</code> and <code>AbstractSqlStyle</code>, choose the first option if you don't. Have a look at bundle <code>org.eclipse.scout.jdbc.derby</code> for an example.<br />
<br />
== Providing JDBC Connector in a Fragment Bundle ==<br />
In this example we will create a fragment bundle containing the MySQL JDBC connector.<br />
<br />
# Download the current MySql jdbc driver, e.g. mysql-connector-java-5.1.16-bin.jar<br />
# Create a new fragment project in eclipse: File -> New -> Other... (or hit [Ctrl+N])<br />
# Choose Plug-in Development -> Fragment Project in the wizard, click 'next'<br />
# Choose a project name, e.g. com.example.myproject.jdbc.mysql.fragment<br />
# Untick checkbox 'Create a java project', keep the other settings, click 'next'<br />
# Fill the 'Properties' section<br />
## Set the Version to '5.1.16' (or whatever version of MySql you are using)<br />
## Set a name for the fragment, e.g. 'MySql jdbc connector'<br />
## Set a Provider (or keep empty)<br />
# Fill the 'Host Plug-in' section<br />
## Set Plug-in ID to org.eclipse.scout.rt.server (this is important!)<br />
## Minimum and maximum version can be left empty<br />
# Finish the wizard. A new fragment project is created in your workspace (it should contain a folder META-INF with the MANIFEST.MF file and also a build.properties file)<br />
# Create a 'lib' folder in your project: Choose New -> Folder from the context menu of the fragment project<br />
# Drag and drop the MySql library to the lib folder<br />
# Open the MANIFEST.MF file (double-click). The manifest editor opens, it has multiple tabs (at the bottom). Switch to the Runtime tab.<br />
# Add the MySql library to the bundle class path (section 'Classpath' on the right). Use the Add.. button and select the jar file from the lib folder. Save the changes.<br />
# Switch to the MANIFEST.MF tab in the manifest editor to see the manifest file in plain text. It should look similar to this:<br />
<source lang="text"><br />
Manifest-Version: 1.0<br />
Bundle-ManifestVersion: 2<br />
Bundle-Name: Mysql jdbc connector<br />
Bundle-SymbolicName: com.example.myproject.server.jdbc.mysql.fragment<br />
Bundle-Version: 5.1.16<br />
Fragment-Host: org.eclipse.scout.rt.server<br />
Bundle-RequiredExecutionEnvironment: JavaSE-1.6<br />
Bundle-ClassPath: lib/mysql-connector-java-5.1.16-bin.jar<br />
</source><br />
<br />
You can now add the new fragment to the product dependencies:<br />
Open the product configuration file of the server bundle (e.g. com.example.myproject.server -> products -> development, open the .product file)<br />
Add the new fragment in the Dependencies tab. Switch to the Overview tab, click the 'Synchronize' link in the 'Testing' section, then click the link to 'Launch an eclipse application in debug mode'.<br />
<br />
== Providing JDBC Connector in a Bundle (With Additional Sources) ==<br />
In this example we will create a bundle containing the SQL driver for Microsoft SQL Server. This bundle will also provide the classes <code>AbstractMicrosoftSqlService</code> and <code>MicrosoftSqlStyle</code> which will be exported and can be used in your Eclipse Scout projects.<br />
<br />
* 1. Download the current MS SQL Server JDBC driver (say sqljdbc.jar)<br />
* 2. Create a plugin project: File -> New -> Other... (or hit [Ctrl+N]) lets say 'org.eclipse.scout.rt.jdbc.microsoft'.<br />
* 3. Create the folder 'lib' and put the JDBC driver jar into the folder.<br />
* 4. Open the file 'META-INF/MANIFEST.MF', the manifest editor opens. <br />
* 5. Switch to the 'Runtime' tab and add the sqljdbc.jar to the 'Classpath' box. <br />
* 6. Switch to the 'Dependencies' tab and add 'org.eclipse.scout.rt.server' to the 'Required Plug-ins' box.<br />
* 7. Switch to the 'MANIFEST.MF' tab and add the line:<br />
<source lang="text"><br />
Eclipse-RegisterBuddy: org.eclipse.scout.rt.server<br />
</source><br />
* 8. Create a new class <code>org.eclipse.scout.rt.jdbc.microsoft.AbstractMicrosoftSqlService</code> (the {{ScoutLink|Concepts|Sql Service|sql service}}):<br />
<br />
<source lang="java"><br />
public abstract class AbstractMicrosoftSqlService extends AbstractSqlService {<br />
<br />
@Override<br />
protected Class<? extends ISqlStyle> getConfiguredSqlStyle() {<br />
return org.eclipse.scout.rt.jdbc.microsoft.MicrosoftSqlStyle.class;<br />
}<br />
<br />
@Override<br />
protected String getConfiguredJdbcDriverName() {<br />
return "com.microsoft.sqlserver.jdbc.SQLServerDriver";<br />
}<br />
<br />
@Override<br />
protected String getConfiguredJdbcMappingName() {<br />
return "jdbc:sqlserver://[host][:port];DatabaseName=[database]";<br />
}<br />
}<br />
</source><br />
* 9. Create a new class <code>org.eclipse.scout.rt.jdbc.microsoft.MicrosoftSqlStyle</code> (the {{ScoutLink|Concepts|SqlStyle|sql style}}):<br />
<br />
<source lang="java"><br />
public class MicrosoftSqlStyle extends AbstractSqlStyle {<br />
<br />
@Override<br />
public String getConcatOp() {<br />
return "+";<br />
}<br />
<br />
@Override<br />
public String getLikeWildcard() {<br />
return "%";<br />
}<br />
<br />
@Override<br />
protected int getMaxListSize() {<br />
return 1000;<br />
}<br />
<br />
@Override<br />
public boolean isLargeString(String s) {<br />
return (s.length() > 4000);<br />
}<br />
<br />
@Override<br />
public boolean isBlobEnabled() {<br />
return true;<br />
}<br />
<br />
@Override<br />
public boolean isClobEnabled() {<br />
return true;<br />
}<br />
<br />
@Override<br />
public String createDateTimeIsNow(String attribute) {<br />
return "TRUNC(" + attribute + ", 'MI')=TRUNC(SYSDATE, 'MI')";<br />
}<br />
<br />
@Override<br />
public String createDateTimeIsNotNow(String attribute) {<br />
return "TRUNC(" + attribute + ", 'MI')!=TRUNC(SYSDATE, 'MI')";<br />
}<br />
<br />
@Override<br />
public void testConnection(Connection conn) throws SQLException {<br />
Statement testStatement = null;<br />
try {<br />
testStatement = conn.createStatement();<br />
testStatement.execute("SELECT count(1) FROM dbo.sysobjects");<br />
}<br />
finally {<br />
if (testStatement != null) try {<br />
testStatement.close();<br />
}<br />
catch (Throwable t) {<br />
}<br />
}<br />
}<br />
}<br />
}<br />
</source><br />
* 10. Open the manifest editor again. Switch to the 'Runtime' tab. Add the package which contains the two created classes to the exported packages.<br />
* 11. Open the '*.product' files of your server bundle. Switch to the 'Dependencies' tab and add the created plugin <code>org.eclipse.scout.rt.jdbc.microsoft</code>. (If you do not need the derby sql service you can remove the bundle <code>org.eclipse.scout.rt.jdbc.derby</code> from the dependencies).<br />
* 12. Switch to the Scout perspective and create a new <code>SqlService</code>: server/Common Services/Sql Services. Use <code>AbstractMicrosoftSqlService</code> as a super type.<br />
* 13. Override the <code>getConfiguredJdbcMappingName</code> method and replace <servername> and <port>. If username and password are required, override the methods <code>getConfiguredUsername</code> and <code>getConfiguredPassword</code>.<br />
<br />
== Bundles, Fragments and Class Loading ==<br />
The above two examples take care to allow the bundle <code>org.eclipse.scout.rt.server</code> to load the JDBC driver class provided by the external jar library. The Eclipse Scout server bundle explicitly loads the JDBC driver in class <code>SqlConnectionBuilder</code> through a method call to <code>Class.forName(String)</code>. This call will fail if the JDBC driver class is not available in the bundle classpath.<br />
The first example works because a fragment's bundle classpath is directly added to the host bundle. The second example works because of the equinox-specific ''buddy classloading'' mechanism. for more information about buddy classloading, see: [[Context Class Loader Enhancements]].</div>Mvi.bsi-software.com