Setting up a database

Top  Previous  Next



The SecondOrder client can store its data in a relational database, which is a Very Good Idea and can save you a great deal of time and effort. It needs a database containing tables with particular names and layouts. Rather than describe this in exhaustive detail, I've supplied a sample database with Whisker, for use with Microsoft Access 97 or later. It's on the menu (shown earlier).


However, I strongly recommend you make a copy of this database and do not use the original that I have supplied; firstly, because then you won't lose any data if you uninstall Whisker (this procedure deletes the supplied database), and secondly, because you can make multiple copies for different purposes (perhaps different experimenters).


Configuring an ODBC data source


SecondOrder chooses and finds its database using the Open Database Connectivity (ODBC) system, which allows programs to talk to databases from a wide variety of manufacturer (i.e. not just Access). You must set up your copy of the database as a data source.


ODBC must be installed on the computer. (It is part of Windows 2000 and installed by all database software.)


1.Configure a data source name (DSN) to point to the database(s) you want to use. Run Start Settings Control Panel ODBC Data Sources.
2.You may add your data source as a "User DSN", which will be visible only to the user you configure it with, or a "System DSN", which will be visible to all users of the system. (You could probably use a File DSN as well, but never mind that.)
3.Choose Add, then choose a database driver (e.g. "Microsoft Access Driver").
4.Then define a data source name (DSN), which should have no spaces in it (e.g. Rudolf_SecondOrder).
5.Click Select to browse your directories and choose the database that this DSN will connect to.
6.Click OK.


Good. Now when you run SecondOrder, this DSN will be among the list you can choose from when your session is complete.



Technical notes


Record-locking. When several copies of SecondOrder are running, there is a chance that they both try to store their data in the same database at (almost) the same time. This creates a problem: the first copy will lock the tables while it stores new data, during which time the second copy can't gain access. If this happens, the second client will report an error, and the user can (and is recommended to) click Retry to have another go.


Configuring MS Access database parameters. However, we can reduce the likelihood of an error being reported by making the database system try for longer itself. In any Access database that you wish to configure, choose Tools Options Advanced. You can then specify the Number of Update Retries (default 2, you want 10) and the ODBC Refresh Interval (default 250 ms, you want 1000 ms). This has already been done for the second-order database.