Simple Database Example

Top  Previous  Next

The model odbctest.mdl along with the Microsoft Access Database odbctest.mdb provides a simple example of the ODBC connectivity.  The database has a table describing variables along with a unique index for each variable subscript combination.  There are no internal constraints on referential integrity in this database, but those should be included for a more complete application.  Given the nature of  the type of information Vensim will write to a database, failure because of constraint violations is unlikely except when you are using an INSERT statement without a corresponding DELETE statement.

The model SimpleInventoryWrite.mdl uses the :BIND approach to linking database entries to model variables. This model also uses the odbctest.mdb database, but different tables in the database. This model is a standalone model, but can be run with the post processing file SimpleInventoryInsert.vdo to demonstrate inserting records into the database. After this has been executed you can also use the SimpleInventoryUpdate.vdo post processing file to update value (for example change NOISE SEED then run this.

The model SimpleInventoryRead.mdl uses the :BIND approach for reading values from a database. Note that the database installed has empty tables so you must first run the SimpleInventoryWrite model to populate these tables.