HOWTO - Sashipa development

 How to create a default application with HSQL.

You wish to develop a Sashipa application for your database, but you haven't the product dbms. Or Database2Sashipa doesn't work on your dbms (MySQL 3.23, MS Access, ...).

1 - Creating the database on HSQL

It's very easy to install HSQL. Download HSQL in zip format, then unzip: it's ready to use !

HSQL can be used in several mode. For us the easier is to use the file mode (it's the default mode). For launching the database manager, execute <hsql-home>/demo/runManager.bat (.sh under Linux).

Once the connection screen opened, replace the last part ('mem:.') in the URL field, by the complete path to your future database - and add a database name. Example:

  jdbc:hsqldb:C:\env\hsqldb\data\BaseDemo

Now click on "OK": HSQL'll create you database files (or will open them if they already exist). Here, three files will be created in the directory C:\env\hsqldb\data\, and they will have as name: BaseDemo with three different extensions.

In the top right area, write the SQL script for creating tables. The documentation on HSQL syntax is available in <hsql-home>/doc/hsqlSyntax.phpl. Do not forget to declare all foreign keys.

In the file mode, only one simultaneous connection can exist. So, close the database manager.

2 - Generating a default Sashipa code

In a shell, change directory to the melbalab root. You have now to choose to use the command line Database2Sashipa version, or the graphical interface version.

2.1 - In command line

Here is the command :

  d2s -s hsqldb -db BaseDemo
      -u sa -cn C:\env\hsqldb\data\BaseDemo
      -f src_xml/BaseDemo_Auto.xml -l en

Once the commande terminated, rename the file src_xml/BaseDemo_Auto.xml to src_xml/BaseDemo.xml: your file is ready to be modified.

NB: It's possible (but dangerous !) to generate the file without the '_Auto' suffix. It's quite dangerous because the Database2Sashipa command replaces previous file without warning...

2.2 - Via the graphical interface

Because your database is empty, you should use the Database2Sashipa graphical interface:

  d2s -f src_xml/BaseDemo_Auto.xml -l en -gui

In the opened screen, enter connection parameters then click on "Scan". If the connection is succeeded, then tables appear on the left.

Development of this graphical interface isn't finished, so there are several bugs. But you can specify for each table: the estimated number of rows, and singular and plural table names.

Once the program is terminated, rename the file src_xml/BaseDemo_Auto.xml to src_xml/BaseDemo.xml: your file is ready to be modified. NB: It's possible (but dangerous !) to generate the file without the '_Auto' suffix. It's quite dangerous because Database2Sashipa replaces previous file without warning...

2.3 - Once your file is generated

Once your file is generated, a good habitude is to edit the file for adding a comment at the end of the file, with:

Comments are in XML format, like this:

  <!--
  ... my commands ...
  ... my SQL script ...
  -->

Important: double dash (--) aren't allowed in XML comments.

3 - Building...

Now you are ready to build your software. In a shell - and still from the directory <melbalab-home>/ - enter:

  s2m BaseDemo

... this command creates a file <melbalab-home>/result/BaseDemo.jar.

You can now execute the result application, by double-clicking on the file or with the shell command:

  java -jar result/AppliBaseDemo/guiBaseDemo/GuiBaseDemo.jar

4 - Using an other DBMS

After that if you wish to use an other DBMS, just change connection informations in the dbConnection element at the end of file. Then rebuild.

© Copyright 2003 Sashipa-Melba Team. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License as much as this note clearly appears.