Connecting to the database

The Import Data from a JDBC Data Source page allows you to define a database connection configuration for nodes and links and then load your data.
This section uses the Arizona example.
To create a database connection configuration:
  1. Click New Configuration to name a new database connection configuration.
  2. Name it Arizona.
  3. Specify a URL to connect to the database.
    The Universal Resource Locator (URL) can indicate a connection to a remote database or a path to a local file. It specifies the driver to use and the path to the file or database.
    The default driver is Microsoft® Excel® ; this is correct for the Arizona data. The path is relative to the Designer run file location.
    1. Click the Ellipsis button.
    2. Browse to select the data file ArizonaData.xls .
      Note that the Designer replaces only the file name in the URL.
  4. Specify your user name and password, if these security items are required.
    If your data is in a local file (as the Arizona data is), you do not have to enter a user name and password. If your data is in a database, the Database Administrator can provide the information.
  5. Specify an SQL query string for nodes (in the Nodes tab) and an SQL query string for links (in the Links tab).
    If the database is a Microsoft® Excel® file, you specify the name of the sheet instead of a table name. The default sheet names in Excel® are just Sheet1, Sheet2, and so on.
    The default query shown selects all columns from an Excel® sheet called Nodes, as follows:
    select * from [Nodes$]
    In the example supplied as ArizonaData.xls , suitable queries are as follows:
    For node data:
    select T1.*, T2.Availability, T2.Throughput from [Sheet1$] as T1, [Sheet2$] as
    T2 where T1.City = T2.City
    For link data:
    select * from [Sheet3$]
  6. Click Execute Query to execute the SQL query.
  7. Click Save Configuration to store the database connection configuration for future use.
    The database connection configuration is stored in the project file.
    Note that the Rogue Wave® predefined connections cannot be saved. In the case of a predefined connection, the Save Configuration button is disabled.
    After executing an SQL query, you see the data in tabular form in the Preview pane, see the following figure for node data.
    diada_databasenodes31.png
    Retrieving Arizona node data
  8. Check that the data retrieved is as required.
    See also the following figure for link data.
    diada_databaselinks32.png
    Retrieving Arizona link data
  9. Click Next to proceed.