Preparing the Database

This procedure applies only to the preparation of an MSSQL database. Please edit the wiki to include alternatives, or consult the mailing list for help with alternatives.

To seed the database and create accounts:

  1. In an XML editor, open the file C:\stonehenge\stocktrader\dotnet\setup_utilities\SetupActions\App.config (assuming C:\stonehenge is the directory to which the source code was checked out).

    This is a configuration file for a .NET console application that was written to initialize the MSSQL database.

  2. Update the value for the dbServer key to point to your SQL Server instance:
     
    <add key="dbServer" value="INSTANCE HERE" /> 
    

    If you are using SQL Server 2008 Standard Edition (as opposed to express) you can likely leave this setting as it is. If you are using SQL Server 2008 Express, you will likely need to update this path to COMPUTER_NAME\SQLExpress or simply .\SQLExpress if SQL Server Express is running locally.

  3. If you checked out the solution to a directory other than C:\StockTraderDemo, then update the value for the installPath key (e.g., C:\stonehenge\stocktrader\dotnet):
     
    <add key="installPath" value="ALTERNATE PATH HERE" /> 
    
  4. Update the value for the dbPassword key to match the password for the sa account in SQL Server:
     
    <add key="dbPassword" value="PASSWORD HERE" /> 
    
  5. Save the changes
  6. At a command prompt, type and execute the following commands:
    %windir%\Microsoft.NET\Framework\v3.5\msbuild.exe "C:\stonehenge\stocktrader\dotnet\setup_utilities\SetupActions\SetupActions.sln" /t:Build
    C:\stonehenge\stocktrader\dotnet\setup_utilities\SetupActions\bin\Debug\SetupActions.exe
    

    If you receive any error messages here, they should be forwarded on to the development mailing list.

To update the database server name in the database:

  1. On the Start menu, click All Programs > Microsoft SQL Server 2008 > SQL Server Management Studio
  2. In the Connect to Server dialog, click the Connect button.
  3. In Object Explorer, expand the Databases > StockTraderDB > Tables node.
  4. Right-click the dbo.DBCONFIG table, and then click Edit Top 200 Rows.
  5. In the MSSQL row, in the HOSTNAME column, type the instance name of your SQL Server instance, and then press Enter.

    If you are using SQL Server 2008 Standard Edition (as opposed to express) you can likely leave this setting as it is. If you are using SQL Server 2008 Express, you will likely need to update this path to COMPUTER_NAME\SQLExpress or simply .\SQLExpress if SQL Server Express is running locally.

  6. Close the dbo.DBCONFIG table, but leave Microsoft SQL Server Management Studio running.