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

Difference between revisions of "Scout/Tutorial/3.7/Minicrm/Set up SQL Service"

< Scout‎ | Tutorial‎ | 3.7
(Change default configuration settings)
(15 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{note|Scout Tutorial|This page belongs to the [[Scout/Tutorial/Minicrm Step-by-Step|Minicrm Step-by-Step Tutorial]]. It explains how to use a database from your new Eclipse Scout project. You need to have a bare-bones {{ScoutLink|Tutorial|Setup a New Eclipse Scout Project|Scout Project up and running}} in order to continue.}}
+
{{ScoutPage|cat=Tutorial 3.7}}
 +
{{note|Scout Tutorial|This page belongs to the [[{{BASEPAGENAME}}_Step-by-Step|Minicrm Step-by-Step Tutorial]]. Previous step: [[{{BASEPAGENAME}}/Get example database|Get example database]].}}  
  
We want to connect to a database. In Scout terms, the client might want to fill a table with data from the database. It calls a service on the server to provide some table data. That service in turn has to get the data from somewhere. In this case, it sends a SQL statement to a yet another service, the '''SQL service'''. This service will handle connecting to the database and the rest.
+
We want to connect to a database. In Scout terms, the client might want to fill a table with data from the database. It calls a service on the server which provides the desired data. That service in turn has to get the data from somewhere. In this case, it sends a SQL statement to yet another service, the '''SQL service'''. This service will handle connecting to the database and the rest.
  
Eclipse Scout comes with support for [http://db.apache.org/derby/ Apache Derby], [http://www.postgresql.org/ PostgreSQL], and [http://www.oracle.com/de/products/database/index.html Oracle] out of the box. Switching to other solutions like [http://www.hibernate.org/ Hibernate] possible, but is beyond the scope of the tutorial. (Essentially you'll need to use Hibernate beans instead of the FormData objects Eclipse Scout provides for you to communicate between client and server.)
+
Eclipse Scout comes with support for [http://db.apache.org/derby/ Apache Derby] out of the box.
 +
Support for [http://www.postgresql.org/ PostgreSQL] and [http://www.oracle.com/de/products/database/index.html Oracle] is trivial to add
 +
(''For more information, see: {{ScoutLink|HowTo|Write_a_jdbc_connection_bundle|How To write a JDBC connection bundle}}'').
 +
Switching to other solutions like [http://www.hibernate.org/ Hibernate] is possible, but beyond the scope of the tutorial.
  
 
We will use '''Apache Derby''' in this tutorial. Derby is an open source relational database implemented entirely in Java and available under the Apache License.
 
We will use '''Apache Derby''' in this tutorial. Derby is an open source relational database implemented entirely in Java and available under the Apache License.
Line 9: Line 13:
 
== Create a new AbstractDerbySqlService ==
 
== Create a new AbstractDerbySqlService ==
  
Go to the server node and open the tree, drill down to ''Sql Services'' below ''Common Services'' and right click in order to open the wizard to create a new SQL service.
+
Go to the server node and open the tree, drill down to ''Sql Services'' below ''Common Services'' and right-click on it in order to open the wizard to create a new SQL service.
  
 
[[Image:SqlServiceWizard.jpg|SqlServiceWizard.jpg]]
 
[[Image:SqlServiceWizard.jpg|SqlServiceWizard.jpg]]
Line 15: Line 19:
 
Name your new service ''DerbySqlService'' and choose ''AbstractDerbySqlService'' from the combobox ''Super Type'' then click ''Finish''.
 
Name your new service ''DerbySqlService'' and choose ''AbstractDerbySqlService'' from the combobox ''Super Type'' then click ''Finish''.
  
[[Image:Newsqlservice.jpg|Newsqlservice.jpg]]
+
[[Image:Newsqlservice.png|Newsqlservice.png]]
  
{{warning|Missing Derby Support|If the Super Type ''AbstractDerbySqlService'' doesn't appear within the combobox, you need to organize your server project's ''plugin.xml''. Go to the Java Perspective, double click on the server project, open the plugin.xml, go to the ''Dependencies'' tab and add the plug-in ''org.eclipse.scout.rt.jdbc.derby'' to the ''Required Plug-Ins''. If the Super Type still does not appear, make sure that the ''derby.jar'' is in the lib folder of the Java installation. You can get this library directly from [http://db.apache.org/derby/ Apache Derby].}}
+
{{warning|Missing Derby Support|If the Super Type ''AbstractDerbySqlService'' doesn't appear within the combobox, you need to organize your server project's ''plugin.xml''. Switch to the Java Perspective, double-click on the server project, open the plugin.xml file, go to the ''Dependencies'' tab and add the plug-in ''org.eclipse.scout.rt.jdbc.derby'' to the ''Required Plug-Ins''. If the Super Type still does not appear, make sure that the ''derby.jar'' is in the lib folder of the Java installation. You can get this library directly from [http://db.apache.org/derby/ Apache Derby].}}
  
 
[[Image:Serverplugin.jpg|Serverplugin.jpg]]
 
[[Image:Serverplugin.jpg|Serverplugin.jpg]]
Line 23: Line 27:
 
== Change default configuration settings ==
 
== Change default configuration settings ==
  
Adjust the '''settings''' in your ''DerbySqlService'' by editing the '''Jdbc Mapping Name'''. It should point to the folder where you unzipped the DerbyDb to. That's the example database you downloaded {{ScoutLink|Tutorial|Installation and Setup‎|at the beginning of the tutorial}}.
+
Adjust the '''settings''' in your ''DerbySqlService'' by editing the '''Jdbc Mapping Name'''. It should point to the folder where you unzipped the DerbyDb to. That's the example database you downloaded {{ScoutLink|Tutorial|3.7/Minicrm/Get example database|at the beginning of this tutorial}}.
 +
 
 +
Also make sure you have the right '''Jdbc Driver Name''' set.
  
 
Use '''minicrm''' for both '''username''' and '''password'''.
 
Use '''minicrm''' for both '''username''' and '''password'''.
  
 
[[Image:Derbydb.jpg|Derbydb.jpg]]
 
[[Image:Derbydb.jpg|Derbydb.jpg]]
 +
 +
{{warning|Escape Backslashes|Make sure you escape backslashes if you're working on Windows.}}

Revision as of 05:28, 13 April 2012

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

Note.png
Scout Tutorial
This page belongs to the Minicrm Step-by-Step Tutorial. Previous step: Get example database.


We want to connect to a database. In Scout terms, the client might want to fill a table with data from the database. It calls a service on the server which provides the desired data. That service in turn has to get the data from somewhere. In this case, it sends a SQL statement to yet another service, the SQL service. This service will handle connecting to the database and the rest.

Eclipse Scout comes with support for Apache Derby out of the box. Support for PostgreSQL and Oracle is trivial to add (For more information, see: The Scout documentation has been moved to https://eclipsescout.github.io/.). Switching to other solutions like Hibernate is possible, but beyond the scope of the tutorial.

We will use Apache Derby in this tutorial. Derby is an open source relational database implemented entirely in Java and available under the Apache License.

Create a new AbstractDerbySqlService

Go to the server node and open the tree, drill down to Sql Services below Common Services and right-click on it in order to open the wizard to create a new SQL service.

SqlServiceWizard.jpg

Name your new service DerbySqlService and choose AbstractDerbySqlService from the combobox Super Type then click Finish.

Newsqlservice.png

Warning2.png
Missing Derby Support
If the Super Type AbstractDerbySqlService doesn't appear within the combobox, you need to organize your server project's plugin.xml. Switch to the Java Perspective, double-click on the server project, open the plugin.xml file, go to the Dependencies tab and add the plug-in org.eclipse.scout.rt.jdbc.derby to the Required Plug-Ins. If the Super Type still does not appear, make sure that the derby.jar is in the lib folder of the Java installation. You can get this library directly from Apache Derby.


Serverplugin.jpg

Change default configuration settings

Adjust the settings in your DerbySqlService by editing the Jdbc Mapping Name. It should point to the folder where you unzipped the DerbyDb to. That's the example database you downloaded The Scout documentation has been moved to https://eclipsescout.github.io/..

Also make sure you have the right Jdbc Driver Name set.

Use minicrm for both username and password.

Derbydb.jpg

Warning2.png
Escape Backslashes
Make sure you escape backslashes if you're working on Windows.

Back to the top