Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > DSS Supplement

Connecting to Databases with ODBC

Scroll Prev Top Next More

Starting with version 5.1 Vensim DSS has the ability to connect to databases using ODBC.  This makes it much easier to bring data in from enterprise data sources and write simulation results out so that others can make use of them.  The ODBC functionality is not available on the Macintosh and is not supported by the Minimal DLL.  It will work only with Vensim DSS and the full Vensim DLL.


The conceptual framework in which database connectivity works is fairly simple.  During the simulation setup you can specify a database as the source of values for model Constants, Lookups and Data variables.  Then, at the end of a simulation, you can run a script that writes the simulation output to a database.  Thus you can use databases as repositories of important model inputs and results and thereby integrate the modeling work into other information systems.

The mechanics of this integration are a little bit more difficult, mostly because the data storage framework in a database, typically relational, is different from that used in Vensim.  For example, a time series in Vensim is maintained as a variable name followed by a counted set of time and value pairs.  In a relational database it would be common to have a table with information about the variable and a separate table with a time and a value element along with an index related to the first table.  

In developing the ODBC functionality for Vensim we have worked to make it easy to accommodate the above example, which is likely to be fairly typical.  Still there may often be circumstances where the structure of the database needs to be modified somewhat to accommodate the connection to a dynamic model.  The ability to modify database structure in order to make smooth connections is a database design skill, not necessarily something that most dynamic modelers have.  Thus, the integration of a Vensim model using ODBC may require the cooperation of a number of people.

The examples we will use will be for a simple Microsoft Access database.  The same constructs would also work with an Oracle or SQL Server database.  On the Vensim side no changes would be required except for the definition of the connection string.  On the database side each database has slightly different techniques for managing tables.  We have not made any attempt to set up indices and integrity constraints on the database side as the focus here is on the Vensim side.