SQL

What Is SQL ?

Available as part of Simul8 Professional, SQL (Structured Query Language) is a language used to query data sources, normally databases such as Microsoft Access, but also including other SQL compatible packages, such as Microsoft Excel.

Simul8 adheres to the conventions set out in the SQL99 standards approved by the International Standards Organization (ISO).

Simul8 SQL is an extremely powerful way of reading and writing data to and from a data source. Simul8 can create new records, and update or delete existing ones.

Using an external data source reduces the memory overhead for Simul8, and allows access to huge volumes of “real” data, possibly stored on a separate machine or network drive.

Setting up the database source on your PC

Simul8 SQL requires a valid “alias” to exist in the machine running Simul8. An Alias is commonly known as a Data Source Name.

New Data Source Names can be created by using the ODBC Data Source Administrator supplied as part of Windows.

  • Open the Control Panel.
  • Open Administrative Tools / Data Sources (ODBC).. You will need to select either the 32-bit or 64-bit ODBC version that matches the version of Simul8 you have (See File > Help > Architecture within Simul8 to confirm).
  • On the ODBC Data Source Administrator interface, click on “Add…”

Add User Data Source in ODBC Administrator

  • Select the database type, e.g. Microsoft Access Driver(*.mdb), and click on “Finish”.

Choose database type

  • In the Data Source Name box, give your Data Source a name that will later be used in Simul8 to establish the connection. Click on “Select…” to choose the database that you want this reference to point (use the folder list box).

Select database

  • Once the database has been selected, click “OK” on each of the dialog boxes to take you back to the main ODBC Data Source Administrator interface. You will now see that your new database source has been added to the list of available data sources. Click on “OK” and close the control panel.

You are now ready to activate the database import module in the simulation. See the Help file Setting Up a Database Input for instructions on how to set up the SQL Connection within Simul8.

Updating an existing database source in 64-bit Simul8

If you use 64-bit Simul8 to open an SQL connection that was created in 32-bit, you will need to recreate the DSN from the 32-bit ODBC version in 64-bit ODBC. To do this, please follow the instructions listed above under ‘Setting up a new database source’.

Visual Logic Commands