Database Reversing Tool for Astah Professional

This application is created as a sample tool by using Astah API, therefore Chang Vision, Inc. shall not provide technical support for any issues that arose during using this application.

Astah DB Reversing tool is created as a sample tool by using Astah API. This tool enables you to connect to the database and import the contents of database tables into Astah professional.

  1. Before you start
  2. JDBC drivers
  3. Creating a Database
  4. Importing Database
  5. Opening .asta file in Astah professional
  6. Modification on astah DB reversing tool
  1. Before you start

    Read the "License Agreement for the Astah API Sample Programs"
    ("API_sample_program_license_agreement-e.txt", which is stored in astah install folder. )

  2. JDBC drivers

    A JDBC driver needs to be installed in advance to use this astah DB Reversing tool to convert table definitions of database into astah models. Please download an appropriate JDBC driver and set up by yourself.

  3. Creating a Database

    This step will guide you how to create a database and tables using the HSQLDB that we used for our test. If you already have an existing database that contains tables you want to import, skip to next step.

    • Download HSQLDB
      Download the latest version of HSQLDB from the following URL.
      http://hsqldb.org/
    • Install the HSQLDB database
      Install the required J2SE first, then open the HSQLDB zip file you downloaded.
      (* We open the files under "C:\hsqlb-2.2.5\hsqlb" in this instruction)
    • Run HSQLDB from command prompt
      Open a command prompt and type as below.
      cd C:\hsqldb-2.2.5\hsqldb\bin
      runServer
      When it works successfully, a dialog as shown below will appear.

      DataBase Reverse

    • Running HSQLDB Database Manager from command prompt
      Open a command prompt and type as below.

      cd C:\hsqldb-2.2.5\hsqldb\bin 
      runManager
      Change the Type to "HSQL Database Engine Server" then click [OK]
      Database Reverse
    • Executing SQL statement from HSQLDB Database Manager
      Type SQL statements as described below in the right text are of next dialog.
      Database Reverse
      DROP TABLE A IF EXISTS;
      DROP TABLE B IF EXISTS;
      DROP TABLE C IF EXISTS;

      CREATE TABLE A (
      ID INT NOT NULL PRIMARY KEY,
      Name VARCHAR(10)
      );

      CREATE TABLE B (
      ID INT NOT NULL PRIMARY KEY,
      Name VARCHAR(10),
      FOREIGN KEY (ID) REFERENCES A (ID)
      );

      CREATE TABLE C (
      ID INT,
      Name VARCHAR(10),
      FOREIGN KEY (ID) REFERENCES A (ID)
      );
    • Press [Execute] button, then a dialog as shown below will appear.

      Database Reverse
      Select [View] - [Refresh Tree] from Main Menu.
      Database Reverse
      You see that Table A, B and C are created.
      Database Reverse
    • Close HSQLDB Database Manager
      Close HSQLDB Database Manager window.
  4. Importing Database

    1. Running Astah DB reversing tool
      Double-click the "astah Install Folder\api\sample\db_reverse\run.bat” file to run astah DB reversing tool.
      (i.e. C:\Program Files\astah-professional\api\sample\db_reverse\run.bat)
      (Example) In case you use HSQLDB :
      Database Reverse
    2. Setting up the information
      Fill in the required information for the connection, and then click [Connect].

      [URL] jdbc:hsqldb:hsql://localhost
      [User] sa
      [Password] N/A
      [JDBC Driver] org.hsqldb.jdbcDriver
      [Driver path] C:\hsqldb-2.2.5\hsqldb\lib\hsqldb.jar
      [Target Model] C:\result.asta

    3. Connecting to Database
      Press the [Import] button. [Import] button will be available once the connection to the database is established completely.
      db_reverse_4-3_s
    4. Importing database tables into astah
      A message [Import Successfully] will appear when the database reversing is completed successfully.
      db_reverse_4-4_s
  5. Open the .asta file in Astah Professional

    1. Run Astah pofessional and open the .asta file that is created
    2. Create ER Diagrams with all reversed tables
      Click on the [ER Model] in the Structure Tree then select [Auto Create ER Diagram] from its Pop-Up Menu.

      db_reverse_5-2-1_en_s

      If you want to create ER Diagrams with certain ER Entities only, create a new ER Diagram then drag and drop ER Entities you want to show from the Structure Tree onto the new ER Diagram.
    3. Show Type and Length of Tables in the Diagram
      Press [Ctrl + A] to select all tables in the Diagram then select [Type & Length Visibility] from its Pop-Up Menu. Table and Length will appear in each tables.
      db_reverse_5-2-2_en_s
    4. db_reverse_5-5_en_s

    5. Re-arrange Layout
      Select [Alignment] - [Auto Layout] from Main Menu to rearrange the model layout.
      db_reverse_5-4_en
    6. Let's zoom in to see the Table A, B and C in the Diagram.
      You can see primary keys, Attributes, Identifying Relationships and Non-Identifying Relationships are created properly in the Diagram.
  6. Modifications on astah DB reversing tool

    1. Read the License Agreement for astah API Sample Programs
      Before you modify the tool, read the "License Agreement for astah API Sample Programs" ( "API_sample_program_license_agreement-e.txt", which is stored in astah install folder. )
    2. Where source code is stored
      Source code written in Java and Astah API of Astah DB reversing tool re stored at :
      astah Install folder\astah-professional\api\sample\db_reverse\*.java
      (i.e.: C:\Program Files\astah-professional\api\sample\db_reverse\*.java )
    3. Making Modification to source code
      As referred in the License Agreement for astah API Sample programs, users are able to modify the source code of the astah DB reversing tool to fit their purposes, however all copyrights and applicable rights to intellectual property with respect to the astah DB reversing tools will belong to the Change Vision, Inc. For more details, read the License Agreement for astah API Sample Programs.
    4. Compiling by using Batch file
      Compiling is available by double-clicking the batch file stored at
      astah Install folder\astah-professional\api\sample\db_reverse\compile.bat
      (i.e. :C:\Program Files\astah-professional\api\sample\db_reverse\compile.bat )
    5. Compiling by using Eclipse and other applications
      Since astah DB reversing tool is designed with astah API, in order to compile by using Eclipse and other applications, you need to set up the "astah-api.jar" to the ClassPath.
      astah-api.jar is stored at :
      astah Install folder\astah-professional\astah-api.jar
      (i.e.:C:\Program Files\astah-professional\astah-api.jar)
      Also to launch the application, you need to set up astah-pro.jar to the Classpath.
      astah-pro.jar is stored at :
      Install folder\astah-professional\astah-pro.jar
      (i.e.:C:\Program Files\astah-professional\astah-pro.jar)